homeassistant-powercalc: Energy sensors became unavailable

System Health details

System Information

version core-2023.5.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.11
os_name Linux
os_version 6.1.29
arch x86_64
timezone Europe/Vienna
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4992
Installed Version 1.32.1
Stage running
Available Repositories 1295
Downloaded Repositories 43
Home Assistant Cloud
logged_in true
subscription_expiration 1 January 2018 at 01:00
relayer_connected false
relayer_region null
remote_enabled false
remote_connected false
alexa_enabled true
google_enabled true
remote_server null
certificate_status null
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 10.2
update_channel stable
supervisor_version supervisor-2023.04.1
agent_version 1.5.1
docker_version 23.0.6
disk_total 62.3 GB
disk_used 7.0 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Terminal & SSH (9.7.0), Samba share (10.0.2), File editor (5.6.0), Samba Backup (5.2.0), AdGuard Home (4.8.7), Grafana (8.3.0), Glances (0.19.2), Nginx Proxy Manager (0.12.3), Zigbee2MQTT (1.30.4-1), Mosquitto broker (6.2.1), Tailscale (0.11.1), TileBoard (1.3.8)
Dashboards
dashboards 1
resources 31
views 12
mode storage
Recorder
oldest_recorder_run 21 October 2022 at 07:47
current_recorder_run 30 May 2023 at 11:49
database_engine mysql
database_version 10.3.32
Sonoff
version 3.5.1 (122751c)
cloud_online 2 / 2
local_online 0 / 0

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

Suddenly all energy sensors in powercal became unavailable. I updated to the newest version 1.6.3, which seems to address something similar. image

Reproduction steps

Debug logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/powercalc/sensor.py", line 268, in async_setup_entry
    entities = await create_group_sensors_from_config_entry(
  File "/config/custom_components/powercalc/sensors/group.py", line 187, in create_group_sensors_from_config_entry
    resolve_entity_ids_recursively(hass, entry, SensorDeviceClass.ENERGY),
  File "/config/custom_components/powercalc/sensors/group.py", line 352, in resolve_entity_ids_recursively
    resolved_ids.extend([sorted_entities[0]])
IndexError: list index out of range

Diagnostics dump or YAML config

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 31 (23 by maintainers)

Most upvoted comments

I’ve had the same issue over the last week with powercalc energy sensors going unavailable. I’m using the latest version and have the energy sensors setup in my sensors.yaml file. If I turn the device on, the sensors come back online again.

I’ll try and get some debug info for you tomorrow when I get home.

@viking2010 Which sensors are getting unavailable exactly? You are sure you are on the latest version of HA now? And recent version of Powercalc.

The energy sensors and utility meters, which I guess you have problems with, are actually provided by HA core integration. Powercalc only has some magic to create them automatically. So the bug would be also there and probably be better to report at HA core issue tracker.

To rule out that powercalc is the problem you can also just create the energy sensor and utility meter using the HA helpers section (Devices&Services > Helpers). create a Riemann integral sensor (energy sensor) and a Utility meter. When these also have the same problem it’s 100% certain it’s not a powercalc issue.

You could enable debug logging for those components, maybe that gives more insights.

logger:
  default: warning
  logs:
    custom_components.powercalc: debug
    homeassistant.components.utility_meter: debug
    homeassistant.components.integration: debug

Did you upgrade already to latest HA version, as a fix should already be available.

@bramstroker I did the update for the version 2023.6.3 last weekend and it didn’t happen again. Also, sometimes some sensors started to have a crazy comsumption (suddenly very high) and it seems that is also fixed. Thank you.

@Joao-Sousa-71 Thanks for the information. Please have a look into https://github.com/home-assistant/core/issues/92912 as this seems the same issue as you have and a lot of people reported this issue. Did you upgrade already to latest HA version, as a fix should already be available.