homeassistant-powercalc: Energy sensors not updating
System Health details
Ok
Checklist
- I have read the FAQ to see if there is a known solution to my problem.
- I have enabled debug logging for my installation.
- I have filled out the issue template to the best of my ability.
- This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
- This issue is not a duplicate issue of currently previous issues…
Describe the issue
I’m using the new feature to force energy calculations based on the group power.
I noticed these energy sensors don’t update as long the group power doesn’t change. That is a know issue with riemann sensors, so I guess this group power value isn’t updated by a timer (I think you are doing that for individu lights as I noticed this option: force_update_frequency)
Best Eric
Reproduction steps
This Is a config example:
enable_autodiscovery: false
create_energy_sensors: false
create_utility_meters: false
sensors:
- create_group: woonkamer lights
unique_id: powercalc_group_woonkamer_lights
create_energy_sensor: true
force_calculate_group_energy: true
entities:
- entity_id: light.tv_lamp
- entity_id: light.leeslamp
- entity_id: light.bureau_koof
- entity_id: light.zithoek
...
Debug logs
Na
Diagnostics dump or YAML config
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (7 by maintainers)
I did have a look into the rieman helper code. One other change besides forces periodic integration (on time), also the energy sensor is calculated when a state change is “reported”. This means the power sensor reports a state change to the state machine. Previously this was only handled when the power sensor state actually was recorded and actually changed.
So that would be the reason it was working for you already because powercalc power sensors report there state every know and then, this triggers the integration now.
But with my change also the scenario is covered when the power sensor stays fixed but does not report frequent state.
That code means max sub interval is set to
None # disable time based integration, when passed as none or when timedelta equals 0. So I don’t see how it can enable timed interval. But hey… it works 😉 I’ll have a look in a few days when I have some more spare time to see why.