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.06k stars 29.72k forks source link

Cameras disappeared after updating to 2023.11.3 (Unifi-Protect 2.9.42) #104446

Closed shoxcorp closed 9 months ago

shoxcorp commented 9 months ago

The problem

Hello team! Apologies if this has been reported before or if I am posting in the wrong place. After updating to the 2023.11.3 all cameras of Unifi Protect stopped working. After removing the integration and re-adding it, all cameras were fully removed.

What version of Home Assistant Core has the issue?

core-2023.11.3

What was the last working version of Home Assistant Core?

core-2023.11.2

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?

No response

Additional information

No response

home-assistant[bot] commented 9 months ago

Hey there @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!

Code owner commands Code owners of `unifiprotect` 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 unifiprotect` 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)


unifiprotect documentation unifiprotect source (message by IssueLinks)

ethank commented 9 months ago

Seeing this same issue, the error in my logs

ValueError: invalid literal for int() with base 16: '00000000000000 0 000000000000000'
2023-11-29 12:58:00.717 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Video Recorder for unifiprotect
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/__init__.py", line 105, in async_setup_entry
    await _async_setup_entry(hass, entry, data_service)
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/__init__.py", line 137, in _async_setup_entry
    await data_service.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 114, in async_setup
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 134, in async_refresh
    updates = await self.api.update(force=force)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/api.py", line 600, in update
    self._bootstrap = await self.get_bootstrap()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/api.py", line 776, in get_bootstrap
    return Bootstrap.from_unifi_dict(**data, api=self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 124, in from_unifi_dict
    data = cls.unifi_dict_to_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/bootstrap.py", line 202, in unifi_dict_to_dict
    return super().unifi_dict_to_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 356, in unifi_dict_to_dict
    data[key] = cls._clean_protect_obj_dict(data[key], unifi_dicts[key], api)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 302, in _clean_protect_obj_dict
    items[key] = cls._clean_protect_obj(value, klass, api)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 286, in _clean_protect_obj
    return klass.unifi_dict_to_dict(data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/devices.py", line 910, in unifi_dict_to_dict
    return super().unifi_dict_to_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 916, in unifi_dict_to_dict
    return super().unifi_dict_to_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 788, in unifi_dict_to_dict
    return super().unifi_dict_to_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 339, in unifi_dict_to_dict
    data[key] = convert_unifi_data(data[key], cls.__fields__[key])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/utils.py", line 239, in convert_unifi_data
    return type_(value)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/uuid.py", line 179, in __init__
    int = int_(hex, 16)
          ^^^^^^^^^^^^^
AngellusMortis commented 9 months ago

@ethank Early Access versions are not supported. Restore from a backup to go back to 2.9 or wait until 2.10 goes GA.

shoxcorp commented 9 months ago

I actually have early access updates disabled... is 2.9.42 early access ? Anyway, I guess I just have to wait :)

AngellusMortis commented 9 months ago

I did not tag you. The stacktrace that was posted was from a breaking change in 2.10. The original issue you opened does not have enough details to assist with since you did not provide any of the requested debug information.

shoxcorp commented 9 months ago

Thanks for communicating that, it was not clear to me. I will provide the requested debug information tomorrow.

ethank commented 9 months ago

@ethank Early Access versions are not supported. Restore from a backup to go back to 2.9 or wait until 2.10 goes GA.

Same issue when downgraded to 2.9.42 and also downgraded the NVR firmware to the last working version.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/unifiprotect/__init__.py", line 105, in async_setup_entry await _async_setup_entry(hass, entry, data_service) File "/usr/src/homeassistant/homeassistant/components/unifiprotect/__init__.py", line 137, in _async_setup_entry await data_service.async_setup() File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 114, in async_setup await self.async_refresh() File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 134, in async_refresh updates = await self.api.update(force=force) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/api.py", line 600, in update self._bootstrap = await self.get_bootstrap() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/api.py", line 776, in get_bootstrap return Bootstrap.from_unifi_dict(**data, api=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 124, in from_unifi_dict data = cls.unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/bootstrap.py", line 202, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 356, in unifi_dict_to_dict data[key] = cls._clean_protect_obj_dict(data[key], unifi_dicts[key], api) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 302, in _clean_protect_obj_dict items[key] = cls._clean_protect_obj(value, klass, api) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 286, in _clean_protect_obj return klass.unifi_dict_to_dict(data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/devices.py", line 910, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 916, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 788, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 339, in unifi_dict_to_dict data[key] = convert_unifi_data(data[key], cls.__fields__[key]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/utils.py", line 239, in convert_unifi_data return type_(value) ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/uuid.py", line 179, in __init__ int = int_(hex, 16) ^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 16: '00000000000000 0 000000000000000'

shoxcorp commented 9 months ago

For clarity: I have never enabled early access / releases, always used stable.

I checked the logs, both normal logs and debug logging enabled for the integration.

There is no error showing. Only this is shown when debug logging is enabled for the integration:

2023-12-03 07:47:05.608 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:10.609 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:15.610 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:20.611 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:23.965 DEBUG (MainThread) [pyunifiprotect.websocket] WS Timeout loop sleep 29.957715892000124 2023-12-03 07:47:25.612 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:30.612 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:35.613 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:40.614 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:45.615 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:50.615 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:47:53.925 DEBUG (MainThread) [pyunifiprotect.websocket] WS Timeout loop sleep 25.692921553039923 2023-12-03 07:47:55.616 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:48:00.617 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:48:05.618 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:48:10.618 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:48:15.619 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active 2023-12-03 07:48:19.619 DEBUG (MainThread) [pyunifiprotect.websocket] WS Timeout loop sleep 26.725978172034957 2023-12-03 07:48:20.620 DEBUG (MainThread) [pyunifiprotect.api] Skipping update since websocket is active Further, with debug logging enabled and restarting the system, only info level debugging is included that includes local / personal information which I wont paste in a public page.

I find it interesting there are not more complaints about this. It might be my configuration / settings or just bad luck. I'll keep looking to see what I find further.

I know this is not much to go on, so if you want me to provide anything specific, let me know.

dsvdglenn commented 9 months ago

Same issue over here, but my issues started when protect updated to the last stable release 2.9.42 overnight. I was still on 2023.11.2 with HA en updated today to 11.3 in hope this will solve my problems. But nothing helped. Tried to readd the integration but won’t load any camera.

bionic80 commented 9 months ago

https://github.com/AngellusMortis/pyunifiprotect/pull/325

dsvdglenn commented 9 months ago

Thanks for updating the code. What's the normal release schedule before it will be pushed to a new Home assistant build?

skrilla0 commented 9 months ago

Experiencing the same issue with the integration suddenly breaking overnight. However, I'm on 2023.7.3 with Protect 2.10.10.

AngellusMortis commented 9 months ago

The requested information has not been provided. Closing as cannot reproduce.

If someone would like to actually provide the requested debug logs and diagnostic that is linked and requested in the issue template, feel free to make a new issue.

AngellusMortis commented 9 months ago

@home-assistant close