I would lke to use the helper Combine the state of several sensors with the maximum function to store the maximum power generation of my solar panel.
The maximum does not seem to work properly (and there is not much I could do wrong, I guess ;-)):
The current value of this sensor is: 45 W, but I had already more than 80 W the day before yesterday:
Shouldn’t this store the all-times-high as the maximum value in this helper?
EDIT:
I just recognized that the value is actually decreasing simultaneously to the source sensor.
The only explanation is, that it’s the (current) maximum of all input sensors.
My all-time high max power recording automation, relying on a manually-created input_number helper:
- alias: Energy - max power recorder
description: Updates the maximum power recorder whenever prior maximum is exceeded
id: 0fef4933-5115-4055-91d2-48d5d3a051b7
trigger:
- platform: numeric_state
entity_id: sensor.power_meter_house
above: input_number.max_power
action:
- service: input_number.set_value
data:
entity_id: input_number.max_power
value: "{{ states('sensor.power_meter_house')|float(0.0) }}"
What you mean is, that this statistics is not looking back long enough (e.g. just a few seconds for example)?
But how to configure this when creating the sensor / helper by UI?
What is the default max_age used in the “background” when creating the helper via UI?
@Troon
Thanks for this suggestion - that’s a good approach.
I prefer also manual config for Utility Meters for instance, but first I would like to understand how the max/min here suppused to work.
I will keep this in my backpocket though if I fail to get it done
Thank you, Tom.
It works well.
To be mentioned is that the sampling_size number needs to be reasonably high (to be able to cover the full max_age:
If it’s too low for the desired max_age, the result will look weird (much lower) because it will be the (“incomprehensible”) maximum from sometime within the max_age period (going back in time just the number of sampling_size discrete values.
So the result then can be anything between the currentl value and the real maximum (if sampling size is large enough).
Yeah. The buffer fill ratio attribute of the sensor will give you a good indication if you have a large enough sample size specified. The fill ratio should be near but never reach 1.0.