Closed CSchlipp closed 3 months ago
Many thanks for the contribution. In which regards are the combined sensors misbehaving? They work fine for me and I would like to keep them since they represent the total consumed energy very well.
See https://github.com/pail23/stiebel_eltron_isg_component/issues/202#issuecomment-1991089840 and the screenshots within: The sensor subtracts the daily value end of the day when it is reset to 0 and some time later increases again when the total value is updated by the ISG itself. While I would favor a total sensor that increases over the day instead of once every night as well, that would require a better alignment during those periods to avoid the down&ups that occur with the current implementation.
I'd be fine with updating this branch to not touch the new sensors, if they provide value 🤷🏼♂️
I have implemented some logic to make sure the energy values are only increasing (or resting to 0). There should not be down&ups anymore. Please have a look at the main branch and test it.
This assumes that reduced values as reported in #153 are incorrect and will supress them. I spent a thought on that as well, but found it to be cleaner if the values reported by ISG are taken as the single source of truth without any additional filter added afterwards by the integration.
However, I've rebased & updated the PR to not touch the new sensors at all and only fix the old ones to keep them supported in a backwards compatible way. I would appreciate getting this merged in before any other tests on the new totals to avoid rebasing 😉
Coming from the discussion in #202, there was some resistance against using
SensorStateClass.TOTAL_INCREASING
for the energy meters. An alternative solution is usingSensorStateClass.TOTAL
in combination withlast_reset
, as described in https://developers.home-assistant.io/docs/core/entity/sensor/#entities-representing-a-total-amount.last_reset
is set whenever a meter reads 0, telling HA that the meter value hasn't just decreased, but started a new cycle. Any other value will setlast_reset
toNone
, making HA ignore this field. As only sensors withSensorStateClass.TOTAL
are allowed to have thelast_reset
property, I had to split the Sensor Class.This change restores the previous sensors and removes the misbehaving combined (daily+total) sensors, making it backwards compatible to 2024.2.1 again. It will thus allow to keep the history of those sensors of previous versions.
Decreasing values as reported in #153 will be correctly considered in the sensor readings.
This change has been tested locally for 2 days now.