Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZHA gets stuck in initialization at startup if host is not connected to the Internet #110321

Closed
VenominousX opened this issue Feb 12, 2024 · 6 comments · Fixed by #111159
Closed

Comments

@VenominousX
Copy link

The problem

I am currently having problems with my ISP, the Internet is not working. My Home Assistant is restarted every morning, which now leads to the problem that nothing works anymore.

No lights, no buttons, no monitoring - nothing that depends on ZHA works without internet. Wasn't Home Assistant's plan to not need this dependency to work?

If I use my mobile data to connect to the Internet as a test, everything starts. This is not a good solution.

What version of Home Assistant Core has the issue?

2024.2.1

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

ZHA

Link to integration documentation on our website

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

Diagnostics information

home-assistant_zha_2024-02-12T06-45-05.174Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-02-12 07:31:26.337 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ConBee II for zha
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 163, in async_setup_entry
    zha_gateway = await ZHAGateway.async_from_config(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 196, in async_from_config
    await instance.async_initialize()
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 214, in async_initialize
    await app.startup(auto_form=True)
  File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 226, in startup
    await self.initialize(auto_form=auto_form)
  File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 219, in initialize
    await self.ota.initialize()
  File "/usr/local/lib/python3.12/site-packages/zigpy/ota/__init__.py", line 154, in initialize
    await self.async_event("initialize_provider", self._app.config[CONF_OTA])
  File "/usr/local/lib/python3.12/site-packages/zigpy/util.py", line 81, in async_event
    for result in await asyncio.gather(*tasks, return_exceptions=True):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/ota/provider.py", line 792, in initialize_provider
    await self.refresh_firmware_list()
  File "/usr/local/lib/python3.12/site-packages/zigpy/ota/provider.py", line 801, in refresh_firmware_list
    async with req.get(self.UPDATE_URL) as rsp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1101, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1004, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 637, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

Code owners of zha 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 zha 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)


zha documentation
zha source
(message by IssueLinks)

@TheJulianJES
Copy link
Member

TheJulianJES commented Feb 12, 2024

Known issue. Error handling will be improved soon.
You can disable the OTA providers for now. See the ZHA docs page, copy the OTA YAML part, but change all providers to false.

Other issue:

Docs:
Copy this YAML section into your configuration.yaml, but change true to false everywhere. https://www.home-assistant.io/integrations/zha/#ota-firmware-updates

@VenominousX
Copy link
Author

Nope, does not work with zha config.
Is it possible to install a check that determines the manufacturers used and only activates the OTA function for the existing manufacturers used? I only have Aqara, Hue and INNR devices, as only manufacturers that are not listed in the ZHA Config. This is slightly annoying when you are disabled by functions for devices that you don't even use yourself.

@TheJulianJES
Copy link
Member

TheJulianJES commented Feb 12, 2024

Again, it's a known bug. Error handling will be improved soon.

Try this:

zha:
  zigpy_config:
    ota:
      ikea_provider: false
      ledvance_provider: false
      salus_provider: false
      sonoff_provider: false
      inovelli_provider: false
      thirdreality_provider: false

If it doesn't work, post the updated exception and integration diagnostics if they can be downloaded.

@VenominousX
Copy link
Author

VenominousX commented Feb 12, 2024 via email

@VenominousX
Copy link
Author

VenominousX commented Feb 12, 2024

@TheJulianJES The configuration as you have posted it works. I had copied the yaml configuration from
home-assistant.io/integrations/zha/#ota-firmware-updates
this morning and set true => false, which doesn't work. Unfortunately I didn't have time to correct it this morning. Thanks for the hint.

The ZHA configuration after copy and paste and storing:
image

Looks like the sonoff line is missing on the website

@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants