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
69.94k stars 29.03k forks source link

Unifi Protect error messages after migrating from HACS custom component to Core integration #66179

Closed frederikrooms closed 2 years ago

frederikrooms commented 2 years ago

The problem

After I uninstalled Unifi Protect custom component in HACS, and installed the integration using the Core integrations. I received messages in the log saying there a couple of entries not loaded. I can't figure out what these mean, or how I can solve them, but it's clear that they must be the result of the switch from HACS to the core integration.

It could be coincidence, but I have connection troubles between the Unifi Host and Home assistant. After each restart of the HASS Core I can see an hourly check and fail for a couple of seconds. After reconnecting all my devices are reactivated in my HASS. As a result of the new connection I get these messages with more or less the same timestamp. It creates a lot of traffic in my logging since I have 11 Unifi devices and a smart sensor.

Logger: homeassistant.config_entries Source: helpers/entity_component.py:172 First occurred: 8 februari 2022 20:16:09 (900 occurrences) Last logged: 13:17:22

Error unloading entry UDM-Protect for media_player Error unloading entry UDM-Protect for number Error unloading entry UDM-Protect for select Error unloading entry UDM-Protect for sensor Error unloading entry UDM-Protect for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 466, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 173, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!

What version of Home Assistant Core has the issue?

2022-2-3

What was the last working version of Home Assistant Core?

2022-2-0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Protect

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: helpers/entity_component.py:172
First occurred: 8 februari 2022 20:16:09 (900 occurrences)
Last logged: 13:17:22

Error unloading entry UDM-Protect for media_player
Error unloading entry UDM-Protect for number
Error unloading entry UDM-Protect for select
Error unloading entry UDM-Protect for sensor
Error unloading entry UDM-Protect for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 466, in async_unload
    result = await component.async_unload_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 173, in async_unload_entry
    return await component.async_unload_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @briis, @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


unifiprotect documentation unifiprotect source (message by IssueLinks)

kaaspad commented 2 years ago

getting almost identical issue as well, still happens on 2022-2-7 and only started after migration from HACS here is some of the log:

ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDM-Protect for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 466, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 173, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!

AngellusMortis commented 2 years ago

Please enable debug logging and provide a log of setting HA.

Did you follow the migrations steps listed for migrating from the HACS version? Including deleting the old HACS version of the integration?

frederikrooms commented 2 years ago

@kaaspad I did make some changes, the problem seemed to have disappeared. The only thing is that I don't know for sure what solved the issue:

I did follow the instructions to move the Protect as HACS component to the core integration. It all worked very well, even the Smart sensor was adapted with the new entities. So that could not be the source of the error.

kaaspad commented 2 years ago

@AngellusMortis yes I did the migrations steps, will enable logging. @frederikrooms I will do all three of your steps and see if helps. Thanks!!

AngellusMortis commented 2 years ago

I guess this was not made clear in the migration does, but you must not run the HACS integration on 2022.2.0 or newer. That is likely why you are seeing inconsistent errors as HA is is loading code from both integrations (HACS and core).

kaaspad commented 2 years ago

thanks that was actually clear. I completely removed hacs integration but was still getting the error.

bartbakels commented 2 years ago

same issue here

`Logger: homeassistant.config_entries Source: helpers/entity_component.py:172 First occurred: 29 maart 2022 23:32:12 (1070 occurrences) Last logged: 15:32:12

Error unloading entry UDM PRO for media_player Error unloading entry UDM PRO for number Error unloading entry UDM PRO for select Error unloading entry UDM PRO for sensor Error unloading entry UDM PRO for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 173, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded!`

ggear commented 2 years ago

+1

I am getting the same issue on HAAS 2022.3.1-8 core component having never installed the HACS version.

AngellusMortis commented 2 years ago

Posting "same issue" and "+1" is not productive to the issue. If you are having the same issue and do not have anything else to add please react to the OP with a 👍.

If you actually want to progress the issue, then please provide the debug log of your UniFi Protect integration.

frederikrooms commented 2 years ago

Posting "same issue" and "+1" is not productive to the issue. If you are having the same issue and do not have anything else to add please react to the OP with a 👍.

If you actually want to progress the issue, then please provide the debug log of your UniFi Protect integration.

I did enable debug logging for Unifiprotect. But the HASS becomes unresponsive and creates huge log files that fills my entire disk space in just a couple of hours. Is there another way to provide you feedback? Can I set another level of debug logging that keeps my HASS running in a normal way?

hoferbeck commented 2 years ago

Hi Together,

@frederikrooms the problem is that the default setting is to set everything to "debug" and therefore your HASS becomes unresponsive. you have to set the default for example to "info". (see https://www.home-assistant.io/integrations/logger/)

Config logger:
default: info

@AngellusMortis I also got the Error that the "Config entry was never loaded!`" and checked the Debug Logs. This is what i found:

Logs 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:29 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 173, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for button Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 70, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for camera Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 420, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 554, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for lock Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 85, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for media_player Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 385, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for number Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 87, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for select Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 66, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 243, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry UDMP for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/switch/__init__.py", line 87, in async_unload_entry return await component.async_unload_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Disconnecting websocket... 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Websocket disconnected 2022-04-26 15:21:31 DEBUG (MainThread) [homeassistant.components.unifiprotect] Connect to UniFi Protect 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://192.168.3.129/api/auth/login 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] 200 application/json 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Authenticated successfully! 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://192.168.3.129/proxy/protect/api/nvr 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] 200 application/json 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Adding subscription: > 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://192.168.3.129/proxy/protect/api/bootstrap 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] 200 application/json 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Adding subscription: > 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Scheduling WS connect... 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Connecting WS to wss://192.168.3.129/proxy/protect/ws/updates?lastUpdateId=250e80bd-f55c-41db-a772-c355cb97f16b 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] WS Timeout loop sleep 29.99984226701781 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Connected to Websocket successfully 2022-04-26 15:21:31 INFO (MainThread) [pyunifiprotect.api] Websocket re-connected successfully 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Request url: https://192.168.3.129/proxy/protect/api/events 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] Recieved WS message. Sending to 1 subscribers... 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.api] Processing WS message... 2022-04-26 15:21:31 DEBUG (MainThread) [pyunifiprotect.websocket] WS timeout reset 2022-04-26 15:21:32 DEBUG (MainThread) [pyunifiprotect.api] 200 application/json
bdraco commented 2 years ago

This issue is the same as https://github.com/home-assistant/core/issues/73013, please continue there