So I seem to either do not understand platform statistics (which is fully possible) or there is some sort of gremlin I am fighting…
In my configuration.yaml I have created a few statistics sensors:
If I use “mean” everything works.
If I use “average_linear” it kind of works, however from time to time I loose a few hours of data, if the max_age is 6h
If I on the other hand use “average_linear” with a max age of 72h - it works.
If I choose to look on the graph on the sensor that is used for the statistic sensor, the “sensor.ljussensor_sovrum_air_temperature” it shows data for all time, there are no visible gaps of data.
But for max_age = 6h and average_linera, there are drop outs from time to time for a hour or two - I find no reason for the drop outs. I simply fail to understand why it from time to time is unavaible statistic sensor data… From my point of view the data is in the original sensor - it is just when I set max_age to 6h it seems to fail for me?
I have started seeing the same behaviour. Is this something new? A regression?
Screenshot below shows the source sensor and the average linear statistic sensor.
Hi I have the same problem but depending on the intgration I might have a solution for you.
it seems this happens when the value of the entity_id sensor was not changed during the scan period. In rest there is the possibilty to define a scan interval and force an update even with unchanged sensor value. So if you powerwall_solar_now is defined in the rest integration you might adapt your code according to the example below.
- unique_id: Temperature
name: Outside Temperature
force_update: true
value_template: '{{ value.split(";")[6]|int }}'
unit_of_measurement: "%"
Now I am wondering if there is a way to do the same for the modbus integration?
keep_last_sample = true should prevent the “unknown” state of statistics sensor, right?
But with type linear_average I still get “unknown” when the sensor did not provide a value younger than max_age.
The same but with type mean does not get “unknown” state, this seems to work.