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.57k stars 30.35k forks source link

Switches for Ring Cameras no longer function #128252

Open Mr5Picker opened 3 days ago

Mr5Picker commented 3 days ago

The problem

Switches that control the lights and sirens on my Ring cameras no longer function and return an error message. Not sure when this started but just realized it today,

What version of Home Assistant Core has the issue?

2024.10.2

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

Ring

Link to integration documentation on our website

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

Diagnostics information

config_entry-ring-c01a200e73ffe6ab6130e64c201897f1.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Failed to perform the action light/turn_on. Error communicating with API<function RingLight._async_set_light at 0x7f598f2d40>: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on'

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:00:02 AM (4 occurrences)
Last logged: 10:19:19 AM

[547089310208] Unexpected exception
[546559421328] Unexpected exception
[546658144112] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ring_doorbell/auth.py", line 249, in async_query
    resp.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1121, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 422, message='', url='https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/ring/entity.py", line 63, in _wrap
    return await async_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/ring/light.py", line 83, in _async_set_light
    await self._device.async_set_lights(new_state)
  File "/usr/local/lib/python3.12/site-packages/ring_doorbell/stickup_cam.py", line 152, in async_set_lights
    await self._ring.async_query(url, method="PUT")
  File "/usr/local/lib/python3.12/site-packages/ring_doorbell/ring.py", line 154, in async_query
    return await self._async_query(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ring_doorbell/ring.py", line 176, in _async_query
    return await self.auth.async_query(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ring_doorbell/auth.py", line 255, in async_query
    raise RingError(msg) from ex
ring_doorbell.exceptions.RingError: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 628, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/ring/light.py", line 91, in async_turn_on
    await self._async_set_light(OnOffState.ON)
  File "/usr/src/homeassistant/homeassistant/components/ring/entity.py", line 72, in _wrap
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error communicating with API<function RingLight._async_set_light at 0x7f598f2d40>: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/157122355/floodlight_light_on'

Additional information

No response

home-assistant[bot] commented 3 days ago

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

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


ring documentation ring source (message by IssueLinks)

sdb9696 commented 3 days ago

What HA version did you last have installed?

Mr5Picker commented 3 days ago

I previously had 2024.10.1 and I'm not certain, but I believe that it did work for a time during that version but stopped working at some point. I then upgraded to 2024.10.2 in hopes that would rectify the issue. Also forgot to mention that the switches do correlate correctly to the current status of the lights but are not able to operate them.

sdb9696 commented 3 days ago

So I’m away from my pc tonight but iirc 422 sometimes happens because of ring.com rate limiting you. Do you have any automations that may be firing repeatedly by accident? Try disabling all automations and see if you can change a switch.

Mr5Picker commented 3 days ago

No, I do not have any automations tied to Ring and at most operate the switches 2 times per day. Thanks for looking into this when you can.

jdggit commented 2 days ago

I have similar logs. The problem started 2 days ago. I get this error in the UI when floodlight switch is turned on or off, both manually (via the UI) or by an automation: "Failed to perform the action light/turn_on. Error communicating with API<function RingLight._async_set_light at 0x7f743dbec0>: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/31525054/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/31525054/floodlight_light_on'"

I was at Core 2024.10.2 when the problem started. Rolled back several updates to Core 2024.9.3 and it's happening with this older version as well, but had never happened before 2 days ago. I normally toggle the lights several times a day with an automation, but disabled the automation when the problem started. I just tried turning on a Ring Floodlight for the first time in 24 hours and the problem still exists. No other Ring entities are used in any of my automatons.

I also have a spare test only HA server without Ring. Loaded it with a fresh Ring Integration and connected to my Ring account. Same problem. Rolled HA Core on this server back to 2024.9.3 and exact same problem.

sdb9696 commented 2 days ago

Have you checked your Authorised Devices on ring.com in the Control Centre? If you have a lot of entries you could need to delete all the excess ones.

jdggit commented 2 days ago

Deleted all entries in "Authorized Client Devices" except the web browser. Logged in my phone to be sure Ring was working, no problem. Then went to Home Assistant and found "Authentication expired for 'me', The Ring integration needs to re-authenticate your account". Did it, all Ring entities came back. Toggled the floodlight and got this again:

Failed to perform the action light/turn_on. Error communicating with API<function RingLight._async_set_light at 0x7f6a207d80>: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/443375255/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/443375255/floodlight_light_on'

Verified in Ring's Authorized Client Devices that now only 3 Devices are Authorized. Was about a dozen before.

AndyGerlicher commented 1 day ago

Exactly the same thing happened to me, also started a few days ago. Same error. I have both a Floodlight Cam Pro and a Floodlight Cam. I get the normal events (motion and such), just the 422 trying to change the light state.

hank99scorpio commented 1 day ago

Same problem with me. 422 trying to change the light state.

Core 2024.10.2 Supervisor 2024.10.0 Operating System 13.1 Frontend 20241002.3

ksand012 commented 1 day ago

+1 for this happening to me too. Error 422 when trying to change the state of the light.

Core 2024.10.2 Supervisor 2024.10.0 Operating System 13.1 Frontend 20241002.3

sdb9696 commented 1 day ago

I have a potential fix but as I'm not getting this error myself I am not able to test it to see if it works. If I create a branch in the ring-doorbell library that the HA ring integration uses, would someone on this thread having the issue be able to test it out?

jdggit commented 1 day ago

I could try it on my test system. Let me know how to load the "branch".

sdb9696 commented 1 day ago

These instructions will load the test branch:

https://gist.github.com/sdb9696/3316358301fa335307f3f9a4fb8cbadb

However they only work on HAOS and the branch assumes you are running HA 2024.10.x and not dev otherwise the test branch could be uninstalled

jdggit commented 1 day ago

Not sure exactly what configuration HAOS is or what "dev" is. But I'm at Core 2024.10.2 using a PI and I do everything with a web browser to the UI. Disabled the Terminal & SSH Protection mode and started the terminal. Entered the 4 lines then exited Terminal & SSH and rebooted the PI. Turned on the floodlight:

Failed to perform the action light/turn_on. Error communicating with API<function RingLight._async_set_light at 0x7f680b5120>: HTTP error with status code 422 during query of url https://api.ring.com/clients_api/doorbots/443375255/floodlight_light_on: 422, message='', url='https://api.ring.com/clients_api/doorbots/443375255/floodlight_light_on'

Is there a way to see if the library update is still installed?

sdb9696 commented 1 day ago

When you're in the docker container and run uv pip freeze | grep ring-doorbell what does it say?

jdggit commented 1 day ago

ring-doorbell @ git+https://github.com/python-ring-doorbell/python-ring-doorbell.git@b8af30e9e1ebde4cd0498fbdcca18d5388c15b53