briancmpbll / home_assistant_custom_envoy

171 stars 76 forks source link

lifetime_net_energy_consumption: state class total_increasing, but its state is not strictly increasing #167

Open 2112b opened 9 months ago

2112b commented 9 months ago

Hi, I just did the update from v0.0.18 to v0.0.19 HA and HACS are up to date My metered Envoy Gateway is on v7.6.175

Now, after reboot, there is this entry in the logfile and its states that I should report it, so here it is... :-)

Thanks, azu


Logger: homeassistant.components.sensor.recorder Source: components/sensor/recorder.py:405 Integration: Sensor (documentation, issues) First occurred: 15:51:26 (1 occurrences) Last logged: 15:51:26 Entity sensor.enphase_envoy_lifetime_net_energy_consumption from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 1934304 (1934308.0) with last_updated set to 2023-10-03T13:45:21.254365+00:00. Please report it to the custom integration author.

catsmanac commented 9 months ago

Thanks for sharing @2112b, unless you observe more occurrences of this warning this is probably caused by getting this data from a different source in v0.0.19. Looks like there's a small difference in the values between old and new source.

testuser7 commented 9 months ago

I have these warnings in logs too:

2023-09-29 16:30:10.480 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.envoy_SERIAL_lifetime_energy_consumption_l3 from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 882430 (882431.0) with last_updated set to 2023-09-29T14:29:43.827531+00:00. Please report it to the custom integration author.
2023-09-29 16:35:10.479 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.envoy_SERIAL_today_s_energy_consumption_l3 from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 796 (797.0) with last_updated set to 2023-09-29T14:33:43.697819+00:00. Please report it to the custom integration author.
2023-10-02 09:15:10.420 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.envoy_SERIAL_lifetime_energy_consumption_l3 from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 889853 (889854.0) with last_updated set to 2023-10-02T07:13:06.047158+00:00. Please report it to the custom integration author.
2023-10-03 08:40:10.322 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.envoy_SERIAL_lifetime_energy_consumption_l3 from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 892150 (892151.0) with last_updated set to 2023-10-03T06:37:16.841352+00:00. Please report it to the custom integration author.
catsmanac commented 9 months ago

Almost looks like small rounding issues. According to HA dev pages these kind of entities are best set to total-increasing.

From the reading and looking in my HA statistics table I see that it builds the sum value from the change in values during the day for today_s_energy_production which is marked as TOTAL_INCREASING and does not substract from the running sum if value goes down. Looking at last 7 days which is a TOTAL entity, it will substract if new value is lower as previous value.

With that the question is what best strategy for the data is. I think when TOTAL-INCREASING it will ignore the negative step and then continue counting up in the statistics with the new increased values. When TOTAL it would reduce the running sum and then start adding changes again. Either can be ok, if we understand what the Envoy is actually meaning with the values being lower.