8000 statistics sensor not observing the recent past like it should · Issue #80648 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
statistics sensor not observing the recent past like it should #80648
Closed as not planned
@Bascht74

Description

@Bascht74

The problem

The statistics sensor platform observes the state of a source sensor and provides statistical characteristics about its recent past.
I am using average_linear. As said in the documentation, the average value of stored measurements under consideration of the time distances between them. A linear interpolation is applied per measurement pair. Good suited to observe a source sensor with non-periodic sensor updates and when continuous behavior is represented by the measurements.

Because I want the average_linear values of my entity for the last 15 minutes, I am using max_age. Setting this to a time period will cause older values to be discarded. The sensor value will become unknown if the source sensor is not updated within the time period.

And there is the problem: My temperatur can change in the last 15 minutes, but in some cases the temp sensor sends the same value (e.g. 12.2 degrees) for 15 minutes. Home Assistant doesn't update the sensor, because it is the same value over the time.
After 15 Minutes the max_age setting will delete the state of the entity out of the stored measurements. Then the sensor will become unavailable because the average_linear is the same for the max age.

If I could use the sampling size, that wouldn't happen. But I cannot use that because the temp hardware will send the values not in static time slots (not know how much it will send in 15 minutes).

On one side you could say it works exactly the way the documentation says, but on the other side you cannot create a sensor that will give a 15 minute average, if the values are not changing at least once in that time.

I would expect that a statistics sensor would deliver the average_linear value over the 15 minutes, even when the value doesn't change. To get that behaivior, the last left (recent) value shoudn't be deleted from the stored measurements.

I am not shure if this can be counted as an issue, maybe it is a feature request (as it would be breaking so that maybe an optional parameter, e.g. keep_last_value could be added to control the expected bahaiviour). Maybe I should add this to the "what the heck" - List, if this is still open.

But it is very anoying that a statistics sensor become unavaiable because the source entity didn't change because the state is constant over time (and you cannot control measurments that in some cases).

What version of Home Assistant Core has the issue?

core-2022.10.4

What was the last working version of Home Assistant Core?

./.

What type of installation are you running?

Home Assistant OS

Integration causing the issue

statistics

Link to integration documentation on our website

https://www.home-assistant.io/integrations/statistics/

Diagnostics information

./.

Example YAML snippet

- platform: statistics
  name: "EG Martina Durchfluss_temp"
  unique_id: eg_martina_durchfluss_temp
  entity_id: sensor.eg_martina_valve_position
  state_characteristic: average_linear
  sampling_size: 8000
  max_age:
    minutes: 15
  precision: 0

Anything in the logs that might be useful for us?

./.

Additional information

As said, a hint how this issue should be treated would be very appreciated.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0