Integrations "failed to set up" without external network (solved: Unifi network settings)

Home Assistant integrations do not work when the internet connection is down. HA does not receive all information from all devices in the local area network. For example, espHome devices are reachable and I can, for example, update the code on them, but they do not send data to HA. esphome integration shows “Not loaded”. In addition, for example, ZHA is in “Failed to set up” mode and Reload does not correct the situation. These should not be dependent on the external network in any way. The same applies to the Shelly integration, which is in “Failed to set up” mode and the devices only work partially. All work if the internet connection is on, even though there is nothing configured in them that would depend on the internet connection, but are directly connected to the HA’s ip address.

What’s weird going on?

My esphome and ZigBee integrations are working fine locally. I can add localtuya and many more into this.

I would suggest you to check with error and debug logs to find out what is causing this, not normal.

1 Like

I agree weirdness is happening but I don’t know if outbound network is the culprit.

What does your log say. Until we have error messages were all just guessing…

Nothing problem before internet connection broke.

There are first few this kind of log event which depens internet connection:

2023-10-31 13:16:50.505 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Sun for sun
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sun/__init__.py", line 99, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR])
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1390, in async_forward_entry_setups
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1411, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/setup.py", line 95, in async_setup_component
    return await setup_tasks[domain]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

After these, there will be similar errors from local devices, such as this ventilation unit:

2023-10-31 13:21:15.624 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Vallox for vallox
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/vallox/__init__.py", line 207, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1390, in async_forward_entry_setups
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1411, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/setup.py", line 95, in async_setup_component
    return await setup_tasks[domain]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

And local MQTT:

2023-10-31 13:21:15.817 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry core-mosquitto for mqtt
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 436, in async_setup_entry
    await async_forward_entry_setup_and_setup_discovery(entry, conf)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 416, in async_forward_entry_setup_and_setup_discovery
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1411, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/setup.py", line 95, in async_setup_component
    return await setup_tasks[domain]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

Same errors continue with only local use Shelly devices:

2023-10-31 13:21:16.029 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry D29 shellydimmer2-4855190009D3 for shelly
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 129, in async_setup_entry
    return await _async_setup_block_entry(hass, entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 199, in _async_setup_block_entry
    await _async_block_device_setup()
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 174, in _async_block_device_setup
    await hass.config_entries.async_forward_entry_setups(entry, platforms)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1390, in async_forward_entry_setups
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1411, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/setup.py", line 95, in async_setup_component
    return await setup_tasks[domain]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

There is some problem in local connections. Below I try to set up SMA solar inverter integrations:

2023-10-31 16:54:33.496 DEBUG (MainThread) [homeassistant.components.sma] Finished fetching sma data in 0.022 seconds (success: True)
2023-10-31 16:54:33.496 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.50 for sma
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sma/__init__.py", line 123, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1390, in async_forward_entry_setups
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1411, in async_forward_entry_setup
    result = await async_setup_component(self.hass, domain, self._hass_config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/setup.py", line 95, in async_setup_component
    return await setup_tasks[domain]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

I can go to this IP and login to the portal. I also get answer for pinging this ip on HA Terminal.

All are back in business after internet connection is back. Why?

I suspect that the problem is in the UniFi network. What could be wrong that the connections of the integrations are lost in the internal network if the internet does not work? The external network connection comes through the UniFi Secure Gateway. I have tested everything possible, but I cannot figure out the reason for this.

I found the reason of this problem in configuration mistake. There was Unifi APs used Meshing even they was connected to the LAN. Without Meshing local devices works also without Internet connection.

When I plug off WAN from Unifi Secure Gateway → local connections doesn’t work if Meshing is actived.