MartinPham / ring-integration-modified

35 stars 0 forks source link

Error when pressing button to open door (sometimes) #4

Open maia opened 10 months ago

maia commented 10 months ago

I assume this issue is caused by the API and not the integration, but ideally there's a better way to catch the error, is there?

Log details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 16:35:52 (3 occurrences)
Last logged: 16:36:03

[546645251264] 422 Client Error: Unprocessable Entity for url: https://api.ring.com/commands/v1/devices/315564105/device_rpc?api_version=9
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 124, in _async_press_action
    await self.async_press()
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 139, in async_press
    await self.hass.async_add_executor_job(self.press)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ring_martinpham/button.py", line 64, in press
    self._device.open_door()
  File "/config/custom_components/ring_martinpham/ring_doorbell_rautsch_martinpham/other.py", line 194, in open_door
    response = self._ring.query(url, method="PUT", json=payload).json()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ring_martinpham/ring_doorbell_rautsch_martinpham/ring.py", line 108, in query
    return self.auth.query(
           ^^^^^^^^^^^^^^^^
  File "/config/custom_components/ring_martinpham/ring_doorbell_rautsch_martinpham/auth.py", line 99, in query
    req.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.ring.com/commands/v1/devices/3[redacted]5/device_rpc?api_version=9
MartinPham commented 6 months ago

should be fixed now with latest commits, thanks