homeassistant-powercalc: energy counters misbehaving/reset/unavailable after 2023.5.0

System Health details

System Information

version core-2023.5.2
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.11
os_name Linux
os_version 5.10.0-19-amd64
arch x86_64
timezone Europe/Stockholm
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4632
Installed Version 1.32.1
Stage running
Available Repositories 1284
Downloaded Repositories 50
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Debian GNU/Linux 11 (bullseye)
update_channel stable
supervisor_version supervisor-2023.04.1
agent_version 1.2.1
docker_version 20.10.21
disk_total 78.2 GB
disk_used 55.7 GB
healthy true
supported true
supervisor_api ok
version_api ok
installed_addons Studio Code Server (5.5.7), MariaDB (2.6.0), InfluxDB (4.6.0), Mosquitto broker (6.2.1), phpMyAdmin (0.8.5), ESPHome (2023.4.4), Frigate NVR Proxy (1.3), Node-RED (14.1.5), Zigbee2MQTT (1.30.4-1), Network UPS Tools (0.11.2)
Dashboards
dashboards 2
resources 30
views 20
mode storage
Recorder
oldest_recorder_run May 4, 2023 at 04:29
current_recorder_run May 8, 2023 at 08:47
estimated_db_size 1681.28 MiB
database_engine mysql
database_version 10.6.12
Spotify
api_endpoint_reachable 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

Noticed today that all energy counters got reset, seems all groups are marked as unavailable until at least one lamp is turned on/off after reboot of HA

I have nestled groups, like “indoor lights -> roomX”, like this: https://github.com/gribber/ha/blob/main/sensors/powercalc.yaml

every room which had at least one unavailable lamp is marked as unavailable (for example, I have some christmas lamps disconnected) Turing on any other lamp in that room makes the group energy counter available again, but with incorrect values

living room group image

main indoor light group image as seen, this groups hasn’t changed since 06:24:55, which is exactly the time I updated to HA 2023.5.0

Reproduction steps

something like:

  1. update to 2023.5.0
  2. disconnect a lamp
  3. reboot

Debug logs

https://pastebin.com/PwTtu6Ls

Diagnostics dump or YAML config

  • platform: powercalc create_group: “outdoor lights” unique_id: 28782826-4b21-44d0-8105-60e6b9338bd2 entities:

    • create_group: “outdoor parking driveway” unique_id: 9366ba2a-8a65-4465-86cf-8651d0765ac2 include: area: parkering_och_uppfart filter: domain: light
    • create_group: “outdoor ambience” unique_id: 4dbfacbd-7fc4-40a6-a4e6-26e385db0f12 include: area: dekoration_ute filter: domain: light
  • platform: powercalc create_group: “indoor lights” unique_id: 0259ae80-3fd3-40fe-9cf9-1857f2e28fc0 entities:

    • create_group: “conservatory” unique_id: 5d77adcf-200f-4111-b1a7-eee8ea1e2a0e include: area: uterum filter: domain: light
    • create_group: “kitchen” unique_id: 24069df6-d3f6-443a-9cc2-ea50b2f1d064 include: area: kitchen filter: domain: light
    • create_group: “family room” unique_id: 49d8f20c-79f0-4a4a-a83f-618ef66c7a83 include: area: allrum filter: domain: light
    • create_group: “bathroom” unique_id: 8555a54f-b7e2-47b0-b85d-d89ce3d8287f include: area: badrum_nere filter: domain: light entities:
      • entity_id: light.bathroom_downstairs_mirror standby_power: 1.2 fixed: power: 12.3
    • create_group: “toilet_upstairs” unique_id: 0267cf53-3359-4686-bfc1-8ffb1f5fa60b include: area: toalett_uppe filter: domain: light entities:
      • entity_id: light.upper_toilet fixed: power: “{{ states(‘sensor.upper_toilet_power’) }}”
    • create_group: “hallway downstairs” unique_id: 12012df5-0c82-44c0-9b7b-3b7a4047f315 include: area: hallen filter: domain: light
    • create_group: “living room” unique_id: 0d8e5469-4703-443e-9110-78f7c27f8319 include: area: living_room filter: domain: light
    • create_group: “hallway upstairs” unique_id: f4e03db2-285a-4c76-98ad-f4b04b7c4e02 include: area: hall_uppe filter: domain: light
    • create_group: “office” unique_id: ffbefefc-deec-4da8-a06e-841890dc8d43 include: area: hobbyrummet filter: domain: light entities:
      • entity_id: light.office_led_strip standby_power: 0.1 fixed: power: 18.4
    • create_group: “bedroom” unique_id: 88566455-3dcf-4aa3-968c-e9545e92b64e include: area: bedroom filter: domain: light
    • create_group: “laundry room” unique_id: 6876c60a-971b-4d89-a3f8-0a8c7110c0ea include: area: tvattstuga filter: domain: light entities:
      • entity_id: switch.laundry_room_channel_1 fixed: power: “{{ states(‘sensor.laundry_room_channel_1_power’) }}”
  • platform: powercalc create_group: “garage lights” unique_id: 765c1684-143e-43da-80b6-8f0ca239db38 entities:

    • create_group: “garage” unique_id: 91a4db55-77bf-49d1-bc51-da2b42c1abbe include: area: garage filter: domain: light
    • create_group: “techroom” unique_id: e226b01a-fd61-4828-bea8-f9a4cb1da3d7 include: area: teknikrum filter: domain: light
    • create_group: “boiler_room” unique_id: 8d0333ee-7245-480d-97d8-5b5450c80049 include: area: pannrum filter: domain: light
    • create_group: “washhouse” unique_id: b5bdb743-c3ab-400e-afc3-d5822341050e include: area: grovtvattstuga filter: domain: light
  • platform: powercalc unique_id: 3788b38d-5330-4c7e-a0ea-8565dda2c6c9 entity_id: sensor.dummy name: “techups” fixed: power: “{{states(‘sensor.techups_power_tmp’)}}”

  • platform: powercalc create_group: “smart speakers” unique_id: f883310e-e09c-4d1c-8ef7-b2e83b530324 entities:

    • entity_id: media_player.hobbyroom_speaker
    • entity_id: media_player.kitchen_display
    • entity_id: media_player.vardagsrummet_speaker
    • entity_id: media_player.sovrummet_speaker
  • platform: powercalc create_group: “environment and air quality” unique_id: f5f210d6-1608-467e-b272-a7b0a83ae6b2 entities:

    • entity_id: fan.livingroom_starkvind fixed: power: > {% set map = { ‘0’ : 0, ‘1’ : 2.0, ‘2’ : 2.8, ‘3’ : 4.8, ‘4’ : 7.6, ‘5’ : 11.9, ‘6’ : 17.8, ‘7’ : 26.3, ‘8’ : 30.6, ‘9’ : 35.8 } %} {{ map[states(‘sensor.livingroom_starkvind_fan_speed’)] if is_number(states(‘sensor.livingroom_starkvind_fan_speed’)) else 0 }}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 28 (25 by maintainers)

Most upvoted comments

Closing this issue as there were also fixes in HA core latest versions regarding energy sensors misbehaving (going negative and things like that).

That increase of energy sensor looks good.

I will have a look into One or more members of the group are unavailable. Have an idea how to improve upon that. It should not make the group unavailable when only a few sensors are unavailable. But just skip these from adding delta values to the energy sensor. Will probably have a look tonight and issue a new beta.