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
72.2k stars 30.23k forks source link

UniFi Protect - G4 Doorbell binary sensor does not trigger since Protect 2.10.11 #106788

Closed MiraiSubject closed 9 months ago

MiraiSubject commented 9 months ago

The problem

I am using the UniFI G4 Doorbell + Dream Machine Pro.

Since December the doorbell automation I have set for this doorbell stopped working. When I check the sensor for it in home assistant it doesn't detect that the button is pressed anymore. I have enabled the last doorbell ring sensor to see if presses do get detected and this does provide data for when the doorbell last was pressed.

I have already tried the following:

Diagnostics were recorded as follows: turned on debug logging, pressed doorbell, waited 15 seconds, exported logs

What version of Home Assistant Core has the issue?

core-2023.12.4

What was the last working version of Home Assistant Core?

core-2022.12.0

What type of installation are you running?

Home Assistant Container

Integration causing the issue

unifiprotect

Link to integration documentation on our website

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

Diagnostics information

home-assistant_unifiprotect_2023-12-31T15-36-32.602Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/websocket.py", line 82, in _process_message
    sub(msg)
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/api.py", line 694, in _process_ws_message
    processed_message = self.bootstrap.process_ws_packet(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/bootstrap.py", line 578, in process_ws_packet
    return self._process_device_update(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/bootstrap.py", line 489, in _process_device_update
    obj = obj.update_from_dict(deepcopy(data))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/devices.py", line 1041, in update_from_dict
    return super().update_from_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 546, in update_from_dict
    setattr(self, key, convert_unifi_data(data[key], self.__fields__[key]))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/utils.py", line 238, in convert_unifi_data
    return type_(value)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/uuid.py", line 175, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
          ^^^^^^^^^^^
AttributeError: 'UUID' object has no attribute 'replace'
2023-12-31 16:34:40.620 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 249, in get
    data = await info.config_entry_diagnostics(hass, config_entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/diagnostics.py", line 21, in async_get_config_entry_diagnostics
    bootstrap = cast(dict[str, Any], anonymize_data(data.api.bootstrap.unifi_dict()))
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/bootstrap.py", line 232, in unifi_dict
    data = super().unifi_dict(data=data, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 476, in unifi_dict
    data[key] = self._unifi_dict_protect_obj_dict(data, key, use_obj)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 432, in _unifi_dict_protect_obj_dict
    obj = obj.unifi_dict()  # noqa: PLW2901
          ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/devices.py", line 985, in unifi_dict
    data = super().unifi_dict(data=data, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 1105, in unifi_dict
    data = super().unifi_dict(data=data, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 976, in unifi_dict
    data = super().unifi_dict(data=data, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 586, in unifi_dict
    data = super().unifi_dict(data=data, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 468, in unifi_dict
    data[key] = self._unifi_dict_protect_obj(data, key, use_obj, klass)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyunifiprotect/data/base.py", line 386, in _unifi_dict_protect_obj
    value = getattr(self, key)
            ^^^^^^^^^^^^^^^^^^
AttributeError: 'Camera' object has no attribute 'event_stats'

Additional information

Pressing Download diagnostics just spits out this HTML in the browser, so all I can provide for now is the debug logs:

<html><head><title>500 Internal Server Error</title></head><body>
<h1>500 Internal Server Error</h1>
Server got itself in trouble
</body></html>

Here are the access control settings for the local account I'm using for HA and Scrypted: image

The doorbell action does trigger on Scrypted providing us homekit notifications

Timeline view:

image

Before 16:23 I was factory resetting and re-adopting the doorbell hence the blank space.

Some extra notes that have an impact on this issue:

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)

AngellusMortis commented 9 months ago

@home-assistant close

AngellusMortis commented 9 months ago

Already fixed.

MiraiSubject commented 9 months ago

I was confused for a sec because there was no new release, but then I noticed the commit and checked out the library's release too.

Thanks!