homeassistant-powercalc: Group power sensors not loaded during startup
| version | core-2025.1.2 |
|---|---|
| installation_type | Home Assistant Container |
| dev | false |
| hassio | false |
| docker | true |
| user | root |
| virtualenv | false |
| python_version | 3.13.1 |
| os_name | Linux |
| os_version | 6.1.0-27-amd64 |
| arch | x86_64 |
| timezone | Asia/Ho_Chi_Minh |
| config_dir | /config |
</markdown-accessiblity-table>Home Assistant Community Store</span>
Home Assistant Cloud</span>
Dashboards</span>
Recorder</span>
Sonoff</span>
Checklist
- <label style="box-sizing: border-box; font-weight: var(--base-text-weight-normal, 400);"></label><span class="Apple-converted-space"> </span>I have read the<span class="Apple-converted-space"> </span>FAQ<span class="Apple-converted-space"> </span>to see if there is a known solution to my problem.
- <label style="box-sizing: border-box; font-weight: var(--base-text-weight-normal, 400);"></label><span class="Apple-converted-space"> </span>I have enabled<span class="Apple-converted-space"> </span>debug logging<span class="Apple-converted-space"> </span>for my installation.
- <label style="box-sizing: border-box; font-weight: var(--base-text-weight-normal, 400);"></label><span class="Apple-converted-space"> </span>I have filled out the issue template to the best of my ability.
- <label style="box-sizing: border-box; font-weight: var(--base-text-weight-normal, 400);"></label><span class="Apple-converted-space"> </span>This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
- <label style="box-sizing: border-box; font-weight: var(--base-text-weight-normal, 400);"></label><span class="Apple-converted-space"> </span>This issue is not a duplicate issue of currently<span class="Apple-converted-space"> </span>previous issues…
Describe the issue
Not sure why but with one of the recent update, Each time restarting homeassistant I need to reload the existing groups i’ve created to get the power sensors to be initialised correctly. Everything else is loaded correctly. I don’t see anything significant or failures in the debug logs.
</div>Reproduction steps
<div class="changed rich-diff-level-zero" style="box-sizing: border-box; box-shadow: inset 4px 0 0 var(--borderColor-attention-muted, var(--color-attention-muted)); display: block; border-radius: 0px; caret-color: rgb(240, 246, 252); color: rgb(240, 246, 252); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">- Create a group<span class="Apple-converted-space"> </span>with fixed<span class="Apple-converted-space"> </span>power sensor for switches
- Check the power sensors have been added correctly
- Restart homeassistant, the new power sensor for the group won’t load unless manually reloading that group’s configuration
Debug logs
Startup Logs:
2025-01-15 08:16:17.836 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.dual_relay_bathroom_left entity_category=None, sensor_name=Bathroom Lights Group 1 power strategy=fixed manufacturer= model= unique_id=pc_0xa4c138d4f2de8691_switch_left_zigbee2mqtt)
2025-01-15 08:16:17.837 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.bathroom_lights_group_1_power to device 33d9ebbbb7c61cd97dbadf87bc68449e
2025-01-15 08:16:17.838 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Creating grouped power sensor: Bathroom Lights power (entity_id=sensor.bathroom_lights_power)
2025-01-15 08:16:17.838 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Creating grouped energy sensor: Bathroom Lights energy (entity_id=sensor.bathroom_lights_energy)
2025-01-15 08:16:17.839 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Load previous energy sensor states from store
2025-01-15 08:16:17.848 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.dual_relay_bathroom_right entity_category=None, sensor_name=Bathroom Lights Group 2 power strategy=fixed manufacturer= model= unique_id=pc_0xa4c138d4f2de8691_switch_right_zigbee2mqtt)
2025-01-15 08:16:17.849 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.bathroom_lights_group_2_power to device 33d9ebbbb7c61cd97dbadf87bc68449e
Manual reload logs:
2025-01-15 08:20:57.044 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.dual_relay_bathroom_left entity_category=None, sensor_name=Bathroom Lights Group 1 power strategy=fixed manufacturer= model= unique_id=pc_0xa4c138d4f2de8691_switch_left_zigbee2mqtt)
2025-01-15 08:20:57.053 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.bathroom_lights_group_1_power to device 33d9ebbbb7c61cd97dbadf87bc68449e
2025-01-15 08:20:57.093 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.dual_relay_bathroom_left: State changed to “off”. Power:0.00
2025-01-15 08:20:57.113 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_1_power: <state sensor.bathroom_lights_group_1_power=unavailable; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 1 power @ 2025-01-15T08:20:57.053777+07:00>
2025-01-15 08:20:57.114 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_1_power: <state sensor.bathroom_lights_group_1_power=unavailable; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 1 power @ 2025-01-15T08:20:57.054598+07:00>
2025-01-15 08:20:57.114 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_1_power: <state sensor.bathroom_lights_group_1_power=0.00; state_class=measurement, calculation_mode=fixed, integration=powercalc, source_entity=switch.dual_relay_bathroom_left, source_domain=switch, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 1 power @ 2025-01-15T08:20:57.093796+07:00>
2025-01-15 08:20:57.115 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_1_power: <state sensor.bathroom_lights_group_1_power=0.00; state_class=measurement, calculation_mode=fixed, integration=powercalc, source_entity=switch.dual_relay_bathroom_left, source_domain=switch, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 1 power @ 2025-01-15T08:20:57.095285+07:00>
2025-01-15 08:21:50.362 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.dual_relay_bathroom_right entity_category=None, sensor_name=Bathroom Lights Group 2 power strategy=fixed manufacturer= model= unique_id=pc_0xa4c138d4f2de8691_switch_right_zigbee2mqtt)
2025-01-15 08:21:50.366 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.bathroom_lights_group_2_power to device 33d9ebbbb7c61cd97dbadf87bc68449e
2025-01-15 08:21:50.377 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.dual_relay_bathroom_right: State changed to “off”. Power:0.00
2025-01-15 08:21:50.381 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_2_power: <state sensor.bathroom_lights_group_2_power=unavailable; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 2 power @ 2025-01-15T08:21:50.367074+07:00>
2025-01-15 08:21:50.382 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_2_power: <state sensor.bathroom_lights_group_2_power=unavailable; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 2 power @ 2025-01-15T08:21:50.367478+07:00>
2025-01-15 08:21:50.382 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_2_power: <state sensor.bathroom_lights_group_2_power=0.00; state_class=measurement, calculation_mode=fixed, integration=powercalc, source_entity=switch.dual_relay_bathroom_right, source_domain=switch, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 2 power @ 2025-01-15T08:21:50.377992+07:00>
2025-01-15 08:21:50.383 DEBUG (MainThread) [custom_components.powercalc.sensors.group.custom] Group sensor sensor.bathroom_lights_power. State change for sensor.bathroom_lights_group_2_power: <state sensor.bathroom_lights_group_2_power=0.00; state_class=measurement, calculation_mode=fixed, integration=powercalc, source_entity=switch.dual_relay_bathroom_right, source_domain=switch, unit_of_measurement=W, device_class=power, friendly_name=Bathroom Lights Group 2 power @ 2025-01-15T08:21:50.378953+07:00>
Config entry:
{"created_at":"2024-10-30T09:58:15.905986+00:00","data":{"_power_entity":"sensor.bathroom_lights_group_1_power","create_energy_sensor":false,"create_utility_meters":false,"entity_id":"switch.dual_relay_bathroom_left","fixed":{"power":21.0},"group":"Bathroom Lights","ignore_unavailable_state":false,"mode":"fixed","name":"Bathroom Lights Group 1","sensor_type":"virtual_power","unique_id":"pc_0xa4c138d4f2de8691_switch_left_zigbee2mqtt"},"disabled_by":null,"discovery_keys":{},"domain":"powercalc","entry_id":"01JBEDS4K1D9TSCEAKGT1JR8S2","minor_version":1,"modified_at":"2024-10-30T09:58:15.908125+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","title":"Bathroom Lights Group 1","unique_id":"pc_0xa4c138d4f2de8691_switch_left_zigbee2mqtt","version":4},
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (11 by maintainers)
Yes, I think we need to close. I’m getting frustrated when things are not working as expected, and always want to get to the bottom. But I agree it takes a lot of time for both of us, and seems rather an edge case. Let me know if you have any further insights in the future and feel free to reopen.
@bramstroker awesome, thanks! Apologies I’ve been away to be able to test your fixes and give you more info. Will report back once I get home next weekend.
p.s. Thanks for this amazing integration and keep up the good work!
@kbullet I’m pretty sure your issue was similar as reported in #3005. Have a fix for that now which I will release today. Please let me know if it also solves for you.
@erkr please see my comments on https://github.com/bramstroker/homeassistant-powercalc/issues/2911, was able to reproduce the template sensor unavailable issue.
Probably still unrelated to the issue @kbullet reported here, but makes sense for @kbullet to retest after I fixed the other issue and create a new release. When the group sensor issue still persists we will investigate further.
Yeah your issue is definitely different then the
unavailabletemplate sensor issue, that’s about the state of an entity. In your case no entities seem to be created at all on startup. Very strange there is no error or any issue to be seen in the logs.