roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
205 stars 32 forks source link

Integration fails if camera is unavailable during startup #80

Closed kylehase closed 2 months ago

kylehase commented 2 years ago

I have a Yi-Dome 1080p camera which is normally powered off via smart switch for privacy and turned on when necessary (I have trust issues with software privacy switching). This worked well with the generic camera and ONVIF integrations before switching to the Yi-Hack integration.

With the Yi-Hack integration v0.3.8, the camera must be powered on during startup or the integration will fail even after the camera is powered on and connected to WiFi. A workaround is to create an automation to turn the camera on before HA shutdown and off again after boot, but that won't work for restarts due to crashes or power outages.

Here's a screenshot of the integration page. Screen Shot 2022-04-10 at 9 05 25 AM

Here's a dump of the log during startup


2022-04-10 08:59:20 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration yi_hack which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-04-10 09:00:08 ERROR (SyncWorker_5) [custom_components.yi_hack.common] Failed to get system configuration from device 192.168<redacted>: error HTTPConnectionPool(host='192.168.<redacted>', port=8080): Max retries exceeded with url: /cgi-bin/get_configs.sh?conf=system (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0bb5007be0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
2022-04-10 09:00:11 ERROR (SyncWorker_1) [custom_components.yi_hack.common] Failed to get mqtt configuration from device 192.168<redacted>: error HTTPConnectionPool(host='192.168<redacted>', port=8080): Max retries exceeded with url: /cgi-bin/get_configs.sh?conf=mqtt (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0bb32334f0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
2022-04-10 09:00:11 ERROR (MainThread) [custom_components.yi_hack] Unable to get configuration from the cam```

I'm not sure what happens if multiple cameras are setup and at least one is online during boot, but I suspect that the integration would work.
roleoroleo commented 2 years ago

I don't know how to fix this problem. It is related to how integrations start (integrations not configured through configuration.yaml). Suggestions?

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.