homeassistant-powercalc
homeassistant-powercalc copied to clipboard
Strange behavior on group sensors with utility meters.
I'm using utility meters on group sensors. When restarting home assistant, some sensors become unavaliable, so the previous values are not read. The energymeter shows a down spike until all the sensors are loaded, the utility meter thinks it needs to be added to them.
I've marked the restarts on the Group power meter.
On the utility meter you can clearly see those restarts and the value added to the utility meter by every restart.
Edit : This is on version 24.0 will see if it's solved on the latest. Edit2: Yes, the issue is still present in the latest version.
@Haxiboy The utility meters are HA core components. I just did a few lines of magic to auto create them from within powercalc. Could you try adding a utility meter for this same energy sensor using the HA way (with the GUI helpers or yaml). https://www.home-assistant.io/integrations/utility_meter/. Then we can rule out that it is an issue in the powercalc way of setting up the utility meters.
It's a bit strange that the energy meters become unavailable for a short amount of time during setup. Will see if I can be able to reproduce this and if this is normal behaviour. But this should not cause the utility meters to spike (as unavailable is just a state that can happen during runtime of HA). Imagine any other energy sensor from for example a Zwave device, that one will also become unavailable in case of a power outage. So it definitely seems a bug in the utility meter integration to me.
When it is actually a bug in the utility meter integration I suggest to make an issue in homeassistant core repo.
https://github.com/home-assistant/core/issues/75896 Seems related
On the first image. It's an energy sensor from powercalc. (Multiple groups in a group). The utility meter created manually behave the same as the integration one. As i can see until the mqtt device unavaliable it reports empty values. I'll try to set retain on these devices to see if it solves the issue.
On the first image. It's an energy sensor from powercalc. (Multiple groups in a group). The utility meter created manually behave the same as the integration one.
Ok, good to know
As i can see until the mqtt device unavaliable it reports empty values. I'll try to set retain on these devices to see if it solves the issue.
I this group consisting of only MQTT sensors? How do the graphs look for the individual sensors at startup?
Btw I have made a small improvement in the group sensor code. When all underlying power sensors are unavailable the group sensor state will also be unavailable. Previously the group sensor had state 0.00. Maybe this also solves your issue.
Released in v0.24.5
Seems like it solved the issue by the newest release.
I think the issue is there again. After every restart an amount gets added to the energy sensors. Propably the problem is group in groups? I'll investigate further.
Utility meter created with HA has the same behavior, as far as i can see it adds the same amount every time. Powercalc reports before entities from zigbee2mqtt loads therefore the powercalc entities have value with 0 then the real value, that gets added to the utility meters.
@Haxiboy Which version of powercalc are you running? There was also a change in v0.25.5 which should improve things. See https://github.com/bramstroker/homeassistant-powercalc/issues/1056 Also I have issue #1030 created some time ago. I will see if I can implement that which should further prevent the underlying group energy sensor to jump to lower values during startup.
There were some additional changes in last versions which could also fix the issue you have @Haxiboy . Are you able to test with v1.0.0-beta.1?
@Haxiboy Which version of powercalc are you running? There was also a change in v0.25.5 which should improve things. See #1056 Also I have issue #1030 created some time ago. I will see if I can implement that which should further prevent the underlying group energy sensor to jump to lower values during startup.
The latest (25.5) i've tested with. I'll test with v1.0.0-beta.1 now
@Haxiboy Did you already manage to test with 1.0.0 beta?
Hello! I'm testing it right now, i was a little busy lately with some projects. As far as i can see, for some of my light bulbs powercalc simply stopped working.
2022-09-30 14:52:37.277 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb1_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>] 2022-09-30 14:52:37.278 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb2_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>] 2022-09-30 14:52:37.278 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb3_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>] 2022-09-30 14:52:37.279 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb4_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>] 2022-09-30 14:52:37.279 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb7_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>] 2022-09-30 14:52:37.280 WARNING (MainThread) [homeassistant.components.integration.sensor] sensor.childsroom_light_ceiling_light_tradfribulb8_light_energy_2 could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
Therefore all my groups that has those entities are unavaliable.
The interesting part that i use the same configuration in livingroom and every other rooms, and are working fine.
Seems like i've found the problem, it's a little strange, propably zigbee2mqtt changed the entity naming scheme >.<
@Haxiboy If I understand correctly everything is working as expected for you now? Can this issue be closed?
Closing this issue, let me know if you still experience issue then we can reopen it.