Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102819

A few bad stats for total_increasing

$
0
0

I have a few entities that are really struggling with stats. I’ve tried to correct the underlying data in the mariadb database but each hour it generates a new stat that is way off the mark. I have 3 examples but the one I’ll focus on is my space heater total kwh:


It shows as using 44,744 kWh. This is a filter entity:

  - platform: filter
    name: "Office Space Heater [kWh]"
    entity_id: sensor.office_space_heater_raw_kwh
    filters:
      - filter: outlier
        window_size: 10
        radius: 5.0

The underlying sensor, office_space_heater_raw_kwh likes to randomly provide a super high value but in this case, I don’t see any of those in the state table:
SELECT * FROM states where entity_id = "sensor.office_space_heater_raw_kwh" and state > 2;
Returns 0 rows. The same with
SELECT * FROM states where entity_id = "sensor.office_space_heater_kwh" and state > 2;
The sensor itself has a pretty normal value:


If I run the query:
SELECT s.* FROM statistics s, statistics_meta sm where s.metadata_id = sm.id and sm.statistic_id = "sensor.office_space_heater_kwh" order by start DESC;
I see the problem statistics:

If I update the two most recent so sum = state the graph is fixed for now but it’ll break again the next hour.

I’m seeing similar challenges with 2 other entities, both are total_increasing.

My questions are:

  1. How is sum calculated for a statistic?
  2. For a total_increasing entity, how does it determine the base value/last reset value?
  3. Any other recommendations for fixing this?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 102819

Trending Articles