bramstroker / homeassistant-powercalc

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

PowerCalc: Cannot connect to powercalc.lauwbier.nl:443 #2277

Closed henriklund closed 3 months ago

henriklund commented 3 months ago

System Health details

System Information

version core-2024.5.5
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.29-haos
arch x86_64
timezone Europe/Copenhagen
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4564 Installed Version | 1.34.0 Stage | running Available Repositories | 1390 Downloaded Repositories | 39
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 | Home Assistant OS 12.3 -- | -- update_channel | stable supervisor_version | supervisor-2024.05.1 agent_version | 1.6.0 docker_version | 25.0.5 disk_total | 125.3 GB disk_used | 56.3 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (18.0.0), AirCast (4.2.1), AirSonos (4.2.1), Duck DNS (1.17.0), Emulated HUE (0.3.0), Emulated HUE (dev) (0.3.0), File editor (5.8.0), Glances (0.21.1), Grafana (10.0.0), Log Viewer (0.17.0), Mosquitto broker (6.4.1), NGINX Home Assistant SSL proxy (3.9.0), Node-RED (17.0.12), Signal Messenger (0.83.0), Studio Code Server (5.15.0), Terminal & SSH (9.14.0), Vaultwarden (Bitwarden) (0.21.2), Victoria Metrics (1.9.1), WireGuard (0.10.2), Z-Wave JS UI (3.6.0), deCONZ (6.23.0), phpMyAdmin (0.9.1), MariaDB (2.7.1), InfluxDB (5.0.0)
Dashboards dashboards | 8 -- | -- resources | 19 views | 64 mode | storage
Miele component_version | 2024.5.0 -- | -- reach_miele_cloud | ok
Recorder oldest_recorder_run | 3 May 2024 at 05:56 -- | -- current_recorder_run | 3 June 2024 at 11:01 database_engine | mysql database_version | 10.11.6
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

Upon restart (after updating PowerCalc), I was met with an error that setup did not complete on time.

Investigation showed problem could related to connectivity to powercalc.lauwbier.nl. Suggestion is to make handling of connectivity related issues more robust.

Lacking option to reload integraion meant second restart of Home Assistant. After this, integration loaded as expected.

Reproduction steps

N/A

Debug logs

2024-06-03 10:48:34.997 INFO (MainThread) [homeassistant.setup] Setting up powercalc
2024-06-03 10:48:44.998 WARNING (MainThread) [homeassistant.setup] Setup of powercalc is taking over 10 seconds.
2024-06-03 10:48:45.244 ERROR (MainThread) [homeassistant.setup] Error during setup of component powercalc
  File "/config/custom_components/powercalc/__init__.py", line 239, in async_setup
  File "/config/custom_components/powercalc/discovery.py", line 123, in start_discovery
  File "/config/custom_components/powercalc/discovery.py", line 144, in get_power_profile
  File "/config/custom_components/powercalc/power_profile/factory.py", line 39, in get_power_profile
  File "/config/custom_components/powercalc/power_profile/library.py", line 49, in factory
  File "/config/custom_components/powercalc/power_profile/library.py", line 35, in initialize
  File "/config/custom_components/powercalc/power_profile/loader/composite.py", line 14, in initialize
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 36, in initialize
  File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 60, in load_library_json
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host powercalc.lauwbier.nl:443 ssl:default [Try again]
2024-06-03 10:48:45.251 INFO (MainThread) [homeassistant.setup] Setup of domain powercalc took 10.25 seconds

Diagnostics dump or YAML config

No response

bramstroker commented 3 months ago

Thanks for reporting. Yes error handling can definitely be improved on this one. Will have a look into that.

bramstroker commented 3 months ago

I have implemented some more robust error handling, and also retry mechanism for the library download. See #2313