home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.84k stars 30.09k forks source link

WARNING: Waiting on integrations to complete setup #120812

Closed vturekhanov closed 2 months ago

vturekhanov commented 3 months ago

The problem

Long integration setup time during Home Assistant startup with one of my Reolink cameras. Camera has an access to the Internet. I started observing the problem two or three months ago. Everything was working fine before that.

What version of Home Assistant Core has the issue?

core-2024.6.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Reolink IP NVR/camera

Link to integration documentation on our website

https://www.home-assistant.io/integrations/reolink/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-06-29 13:54:25.386 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('reolink', '468b877fa104a01e8b1e51569b7e3856'): 851030.112884084}

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `reolink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign reolink` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

starkillerOG commented 3 months ago

Please enable debug logging of the reolink integration and then restart the reolink integration, wait 10 minutes and then disable debug logging and post the resulting log.txt file here. https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging

vturekhanov commented 2 months ago

Sorry for the long delay, I was on a business trip.

There is a lot of information in the log file. Some of it is a bit sensitive from my point of view. I analyzed the log myself and found the following lines. I think this is a reason for the long integration setup and the long HA startup time.

As I mentioned before, this camera has Internet access and it is remotely accessible.

2024-07-08 12:20:43.238 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request params =
{'token': '<token>'}

2024-07-08 12:20:43.238 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request body =
[{'cmd': 'GetDevInfo', 'action': 0, 'param': {}}, {'cmd': 'CheckFirmware'}]

...

2024-07-08 12:21:14.520 DEBUG (MainThread) [reolink_aio.api] Host 192.168.18.231:443: connection timeout, trying again.
2024-07-08 12:21:14.520 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request params =
{'token': '<token>'}

2024-07-08 12:21:14.520 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request body =
[{'cmd': 'GetDevInfo', 'action': 0, 'param': {}}, {'cmd': 'CheckFirmware'}]

...

2024-07-08 12:21:45.520 DEBUG (MainThread) [reolink_aio.api] Host 192.168.18.231:443: connection timeout, trying again.
2024-07-08 12:21:45.520 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request params =
{'token': '<token>'}

2024-07-08 12:21:45.520 DEBUG (MainThread) [reolink_aio.api] Camera1/192.168.18.231:443::send() HTTP Request body =
[{'cmd': 'GetDevInfo', 'action': 0, 'param': {}}, {'cmd': 'CheckFirmware'}]

...

2024-07-08 12:22:16.674 DEBUG (MainThread) [homeassistant.components.reolink] Error checking Reolink firmware update at startup from Camera1, possibly internet access is blocked
2024-07-08 12:22:16.675 DEBUG (MainThread) [homeassistant.components.reolink] Finished fetching reolink.Camera1.firmware data in 93.437 seconds (success: True)
starkillerOG commented 2 months ago

Since HA 2024.7.0 which was released last weak, this should not be an issue anymore. The firmware check is now performed in a seperate background task and will not hold up the startup of the Reolink integration or HomeAssistant core anymore.

Please try updating to HA 2024.7.x and see if the startup time has improved. If not, please let me know!

If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.