10% threshold on total_increasing reset detection causing unexpected values #133588
Open
Description
The problem
I am combining two total_increasing class energy sensors into one with the following configuration in my templates - sensors config:
- unique_id: total_daily_energy
name: Total Daily Energy
unit_of_measurement: "Wh"
device_class: energy
state_class: total_increasing
state: "{{ states('sensor.energy_monitor_a_total_daily_energy') | float(0) + states('sensor.energy_monitor_b_total_daily_energy') | float(0) }}"
availability: "{{ states('sensor.energy_monitor_a_total_daily_energy') | float(none) != none and states('sensor.energy_monitor_b_total_daily_energy') | float(none) != none }}"
The problem is that energy monitor a uses less than 10% of the energy as b, so when a resets, the total drops by less than 10%, and the 10% threshold here:
causes it to log a negative value. If both reset simultaneously, this isn't an issue, and if only b resets, it also isn't an issue as that is a large enough decrease to trigger a reset.What version of Home Assistant Core has the issue?
core-2024.12.4
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
sensor
Link to integration documentation on our website
https://www.home-assistant.io/integrations/sensor/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response