homeassistant-powercalc: Utility meter for domain group not working
I upgraded powercalc to v0.24.6 from v0.22.something and my utility meter for my lights domain group is now broken. It was previously working fine.
Config:
powercalc:
enable_autodiscovery: true
create_domain_groups:
- light
create_utility_meters: true
utility_meter_types:
- daily
Debug log:
2022-08-04 19:44:52 DEBUG (MainThread) [custom_components.powercalc] Setting up domain based group sensors..
2022-08-04 19:44:52 DEBUG (MainThread) [custom_components.powercalc.sensors.group] Creating grouped power sensor: All light power
2022-08-04 19:44:52 DEBUG (MainThread) [custom_components.powercalc.sensors.group] Creating grouped energy sensor: All light energy
2022-08-04 19:44:52 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: All light energy daily (entity_id=sensor.all_light_energy_2_daily)
I suspect the last line is revealing because sensor.all_light_energy_2_daily does not exist. The correct sensor to use should be sensor.all_light_energy_daily.
The only place I could find reference to the wrong sensor via a grep was in .storage/core.restore_state:
"state": {
"entity_id": "sensor.all_light_energy_daily",
"state": "0",
"attributes": {
"state_class": "total_increasing",
"source": "sensor.all_light_energy_2",
"status": "collecting",
"last_period": "0.4340",
"meter_period": "daily",
"cron pattern": "0 0 * * *",
"last_reset": "2022-08-03T14:00:00.071537+00:00",
"unit_of_measurement": "kWh",
"device_class": "energy",
"icon": "mdi:counter",
"friendly_name": "All light energy daily"
},
Again, that source sensor.all_light_energy_2 does not exist. It should be sensor.all_light_energy. I have tried stopping my HASS docker container then manually editing that source line and removing the “_2” from the entity_id but it does not fix anything and is later overwritten. Looking at the code maybe it is appending “_2” as a utility meter type but I couldn’t parse any more than that by just reading the code.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
I’ve had the fixed version running since yesterday. Seems to work fine and survive reboots
Just thought I would add that utlity meters created by powercalc for powercalc light groups work fine, so it seems to be just the domain one.