fwestenberg/reolink_dev

Latest update introduced intermitent bug

rchiileea opened this issue · 2 comments

Describe the bug
Latest release has introduced a bug with camera sometimes not showing, and the person, car and pet detection, its there but on odd occation they are unavailable.

I have rolled back to previous release and issue dissapears.

To Reproduce
image

Both cameras show up with this amount of the sensors being unavailible, its regular and evenly spaced out

Expected behavior
not for sensors to go unavailible ever 20 to 30 mins
Screenshots
image

latest update

image

after rollback to previous release.

Environment:
Please provide useful information about your environment, like:

  • Home Assistant version: 2022.8.7 Hass OS, supervisor and OS kept upto date as well
  • Reolink camera model : it happens to both so I dont think its specific
  • Camera firmware number
    RLC-822A - v3.1.0.956_22041507
    RLC-811A - v3.1.0.956_22042008

Additional context
Rollback fixes the issue and it only appeared in recent update.

I see the same kind of behaviour with my RLC-810A. Firmware numbers for both V1 and V2 are v3.1+.

It think this is related to this commit: #557 showing up more the real state of the Reolink camera status.

I see in the logs many random either:

Timeout fetching reolink.Camera 1.motion_states data

or

Subscription process ended with wrong HTTP status: 400: Bad Request

or

Host <CAMERA_IP> error renewing the Reolink subscription

or

Host: <CAMERA_IP>: Failed to get results for Search, JSON data was was empty?

or

 ERROR code 502/Bad Gateway
Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, 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 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 729, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 747, in handle
    image = await _async_get_image(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    if image_bytes := await camera.async_camera_image(
  File "/config/custom_components/reolink_dev/camera.py", line 197, in async_camera_image
    return await self._base.api.get_snapshot()
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 641, in get_snapshot
    return await self.get_still_image()
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 633, in get_still_image
    response = await self.send(None, param, expected_content_type='image/jpeg')
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1697, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

Which is weird because the cameras are the only points which have networking issues. I do not see any error in the application on the same network or with the web version on the camera, directly. My network is a wired Unifi solution with the camera PoE on the same switch.

Inspecting my network, I don’t have any packet loss or anything.

I wonder if a better retry logic might help?

I'm experiencing the same issue.
RLC-812A
IPC_523B188MP
v3.1.0.920_22040613

HA Core: 2022.11.4
HA OS: 9.3