core: Helper created Tariff Utility Meter incorrectly adjusting values from input source?
The problem
I’ve documented this out in the community forums here: https://community.home-assistant.io/t/negative-values-in-tariff-utility-meter-while-positive-in-parent-source/839130/2
At the daily reset of the input source dropping to zero, the tariff utility meter doesn’t also drop to zero, but instead drops far into negative values.
What version of Home Assistant Core has the issue?
core-2025.1.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Utility Meter
Link to integration documentation on our website
https://www.home-assistant.io/integrations/utility_meter/
Diagnostics information
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
I think this query shows the problem? – last_period should be zero?
sqlite3 home-assistant_v2.db “SELECT m.entity_id, s.state, datetime(round(s.last_changed_ts), ‘unixepoch’) AS ts, json_extract(a.shared_attrs, ‘$.last_period’) AS last_period FROM states s JOIN states_meta m ON s.metadata_id = m.metadata_id LEFT JOIN state_attributes a ON s.attributes_id = a.attributes_id WHERE m.entity_id=‘sensor.pg_e_off_peak’ ORDER BY s.last_changed_ts DESC LIMIT 5;” sensor.pg_e_off_peak|-11197.0|2025-02-01 21:11:23|45420.0 sensor.pg_e_off_peak|-12059.0|2025-02-01 20:42:03|45420.0 sensor.pg_e_off_peak|unknown||0 sensor.pg_e_off_peak|-12059.0||45420.0 sensor.pg_e_off_peak|-11988.0||45420.0
Here’s the parent data: sqlite3 home-assistant_v2.db “SELECT datetime(round(coalesce(s.last_changed_ts, s.last_updated_ts, s.last_reported_ts)), ‘unixepoch’) AS ts, m.entity_id AS sensor, s.state FROM states s JOIN states_meta m ON s.metadata_id = m.metadata_id WHERE m.entity_id=‘sensor.pg_e_daily_consumption’ AND s.state != ‘unknown’ ORDER BY coalesce(s.last_changed_ts, s.last_updated_ts, s.last_reported_ts) DESC LIMIT 5;” 2025-02-01 22:02:21|sensor.pg_e_daily_consumption|47174.0 2025-02-01 22:00:16|sensor.pg_e_daily_consumption|47141.0 2025-02-01 21:59:11|sensor.pg_e_daily_consumption|47123.0 2025-02-01 21:58:06|sensor.pg_e_daily_consumption|47106.0 2025-02-01 21:57:01|sensor.pg_e_daily_consumption|47088.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (11 by maintainers)
The issue here is that the integration still can’t tell if that zero is due to net metering or a reset.