bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances
MIT License
1.02k stars 264 forks source link

Unexpected device class #1887

Closed chrisdev524 closed 1 year ago

chrisdev524 commented 1 year ago

System Health details

System Information

version core-2023.10.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.21-v8
arch aarch64
timezone Europe/Budapest
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.33.0 Stage | running Available Repositories | 1370 Downloaded Repositories | 10
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | September 3, 2024 at 2:00 AM relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-3.ui.nabu.casa certificate_status | ready can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 10.4 -- | -- update_channel | stable supervisor_version | supervisor-2023.10.0 agent_version | 1.5.1 docker_version | 23.0.6 disk_total | 228.5 GB disk_used | 146.0 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.6.0), Google Assistant Webserver (0.0.4), Home Assistant Google Drive Backup (0.111.1), Mosquitto broker (6.2.1), Qbittorrent (4.5.5-4), Samba NAS (10.0.2-nas4), Studio Code Server (5.11.0), Terminal & SSH (9.7.1), VLC (0.2.0), MariaDB (2.6.1), InfluxDB (4.7.0), Paradox Alarm Interface (3.2.1), Grafana (9.0.3), Portainer (2.18.4), Advanced SSH & Web Terminal (15.0.7)
Dashboards dashboards | 6 -- | -- resources | 2 views | 5 mode | storage
Recorder oldest_recorder_run | October 10, 2023 at 10:40 AM -- | -- current_recorder_run | October 11, 2023 at 10:07 PM estimated_db_size | 936.55 MiB database_engine | mysql database_version | 10.6.12
Sonoff version | 3.5.2 (2ad1cd7) -- | -- cloud_online | 7 / 9 local_online | 7 / 7
Xiaomi Miot Auto component_version | 0.7.13 -- | -- can_reach_server | ok can_reach_spec | ok logged_accounts | 1 total_devices | 5

Checklist

Describe the issue

Hi! I have a problem with Energy dashboard and Powercalc entities. When entering the Energy dashboard after a Home Assistant restart, I see that a lot of Powercalc entites have an error "Unexpected device class". As I see in the Developer tools, the Device class attribute is missing for these entities. After a while, when the device is in use, and the Energy is changing, it's getting fixed, and the Device class attribute is added.

Could you add the "Device class: energy" attribute immediately after restart to the Powercalc entities, instead of only after change?

image image

Thank you! Regards, Krisztián

Reproduction steps

  1. Restart Home Assistant
  2. Opening the Dashboard/Energy for edit
  3. Check the error messages, PowerCalc entities for unused devices should be there with "Unexpected device class" error ...

Debug logs

2023-10-11 22:08:02.702 DEBUG (MainThread) [custom_components.powercalc.discovery] switch.backyard_poolconnector: Entity is manually configured, skipping auto configuration
2023-10-11 22:08:04.670 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] No existing energy sensor found for the power sensor 'sensor.backyard_poolconnector_power'
2023-10-11 22:08:04.671 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: PoolConnector energy
2023-10-11 22:08:04.671 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: PoolConnector energy daily (entity_id=sensor.backyard_poolconnector_energy_daily)
2023-10-11 22:08:04.671 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: PoolConnector energy monthly (entity_id=sensor.backyard_poolconnector_energy_monthly)
2023-10-11 22:08:04.672 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: PoolConnector energy yearly (entity_id=sensor.backyard_poolconnector_energy_yearly)
2023-10-11 22:08:04.726 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.backyard_poolconnector_energy to device e602668b62c0da6af6a9fedad70ba3eb
2023-10-11 22:08:04.728 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.backyard_poolconnector_energy_daily to device e602668b62c0da6af6a9fedad70ba3eb
2023-10-11 22:08:04.731 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.backyard_poolconnector_energy_monthly to device e602668b62c0da6af6a9fedad70ba3eb
2023-10-11 22:08:04.735 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.backyard_poolconnector_energy_yearly to device e602668b62c0da6af6a9fedad70ba3eb

Diagnostics dump or YAML config

powercalc: force_update_frequency: 00:01:00 energy_integration_method: left ignore_unavailable_state: true create_utility_meters: true create_energy_sensors: false energy_sensor_precision: 2 utility_meter_types:

bramstroker commented 1 year ago

Thanks for reporting. Should hopefully be fixed with #1898 will be released in upcoming powercalc version.