bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances
MIT License
958 stars 252 forks source link

Waiting on integrations to complete setup #2216

Closed Mariusthvdb closed 5 months ago

Mariusthvdb commented 5 months ago

System Health details

System Information

version core-2024.5.0b1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.21-haos
arch x86_64
timezone Europe/Amsterdam
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1407 Downloaded Repositories | 49 HACS Data | ok
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 31 augustus 2024 om 02:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | false remote_connected | false alexa_enabled | false google_enabled | true remote_server | eu-central-1-5.ui.nabu.casa certificate_status | ready instance_id | f51092d0098f40faa50dfd391c4bf925 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.2.dev20240313 -- | -- update_channel | beta supervisor_version | supervisor-2024.04.4 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 458.4 GB disk_used | 29.9 GB healthy | true supported | true board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | Log Viewer (0.17.0), Samba share (12.3.1), Terminal & SSH (9.13.0), Mosquitto broker (6.4.0), Z-Wave JS (0.5.0), ESPHome (2024.4.0), Studio Code Server (5.15.0), Home Assistant Google Drive Backup (0.112.1), Whisper (2.0.0), Piper (1.5.0), openWakeWord (1.10.0), Matter Server (5.5.1)
Dashboards dashboards | 10 -- | -- resources | 28 views | 116 mode | yaml
Recorder oldest_recorder_run | 13 april 2024 om 14:50 -- | -- current_recorder_run | 27 april 2024 om 10:48 estimated_db_size | 2596.86 MiB database_engine | sqlite database_version | 3.44.2

Checklist

Describe the issue

seeing this since a few restarts (in HA 2024.5 beta):

Logger: homeassistant.bootstrap
Bron: bootstrap.py:688
Eerst voorgekomen: 10:49:36 (1 gebeurtenissen)
Laatst gelogd: 10:49:36

Waiting on integrations to complete setup: {('powercalc', '140072626338432'): 3197947.64381924}

Reproduction steps

  1. simple restart
  2. ...

Debug logs

not yet logged

Diagnostics dump or YAML config

didnt change from before, so probably not related to user config. not sure yet what this means, and all is functional. It didnt show before though, so maybe the speed improvements HA has seen lately are now catching up with Powercalc ;-)

bramstroker commented 5 months ago

Which version of Powercalc are you using?

Mariusthvdb commented 5 months ago

1.12.0-beta5

bramstroker commented 5 months ago

Ah ok, could you try upgrading to beta 6 first? As I'm pretty sure there was an issue causing powercalc to redownload on every startup. When you are still experiencing this issue please enable debug logging for powercalc and share the logs after startup.

I am also doing some additional changes to further improve startup time. https://github.com/bramstroker/homeassistant-powercalc/pull/2217

Mariusthvdb commented 5 months ago

Still there…

Logger: homeassistant.bootstrap
Bron: bootstrap.py:688
Eerst voorgekomen: 11:01:53 (1 gebeurtenissen)
Laatst gelogd: 11:01:53

Waiting on integrations to complete setup: {('powercalc', '139636165091520'): 3285083.602768622}
bramstroker commented 5 months ago

Please share debug logs, then I can see if there is any obvious to see causing a slow down. I have also tried on my test instance running HA beta.5 but I don't have any issues.

Mariusthvdb commented 5 months ago

sure will do, giving it a few restarts, but keep seeing this:

[custom_components.powercalc.power_profile.loader.remote] Remote profile is newer than local profile

130 times....

could it be this is not saved locally correctly after being downloaded?

bramstroker commented 5 months ago

Yes that's definitely the problem, and what I suspected. That should only happen once, but keeps happening every restart for you. It's only a problem with the Powercalc v1.12 beta, which introduced remote loading. I have reworked that check (to see if profile is outdated) a bit in beta.7. Could you please try that one? 90% change this fixes your problem. After first restart it should still be slow one time, but after a second restart you should not see Remote profile is newer than local profile logs anymore.

When still not fixed I might need to add extra debug logging.

Mariusthvdb commented 5 months ago

Confirm the warning does not show now, on 1st restart after installing beta 7

in fact the remote loading isnt even mentioned Ince anymore, just the single

[custom_components.powercalc.power_profile.loader.remote] Loading library.json from github

guess that issue was fixed quickly ;-) with that we can close, thanks Bram!

bramstroker commented 5 months ago

Great to hear @Mariusthvdb. Yes that debug line is expected now. I have added that in beta.7. That should happen everytime at start. To fetch complete update powercalc library information. But that's only a json which contains all possible manufacturers, models and aliases and their updated_at times.

Fetching of the actual profile (and CSV files) to local filesystem should only happen once. Hence the Remote loading lines are gone now.