fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
553 stars 101 forks source link

False person detection after the camera is unavailable #570

Open garry0garry opened 1 year ago

garry0garry commented 1 year ago

HA v2022.9.4, reolink_dev v0.57. Hardware: Reolink RLC-511WA, fw IPC_523128M5MP, sw 3.1.0.956_22041509 - 1 pc. Reolink RLC-520A, fw IPC_523128M5MP_V2, sw 3.1.0.1228_22082201 - 2 pcs. Reolink RLC-520A, fw IPC_523128M5MP, sw 3.1.0.951_22041566 - 9 pcs.

Describe the bug False person detection after the camera is unavailable for all my cameras.

No detection on the camera: Reolink

False detection in the integration:

detected
9:10:38 AM - 1 hour ago
became unavailable
9:09:29 AM - 1 hour ago

reolink_dev

Log for this period:

2022-09-18 09:09:22.033 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:09:22.081 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:09:22.083 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.50.14 error renewing the Reolink subscription
2022-09-18 09:09:29.049 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:09:29.099 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:09:29.102 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.50.140 error renewing the Reolink subscription
2022-09-18 09:09:30.462 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.14: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:30.486 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.14: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:30.871 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 132, in _update_event_range
    end = searchtime_to_datetime(file["EndTime"], start.tzinfo)
  File "/config/custom_components/reolink_dev/base.py", line 533, in searchtime_to_datetime
    return dt.datetime(
ValueError: year 0 is out of range
2022-09-18 09:09:30.891 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.14: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:30.914 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.14: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:30.935 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.14: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:39.056 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.140: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:09:39.078 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.140: Failed to get results for Search, JSON data was was empty?
2022-09-18 09:10:43.108 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:10:43.158 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-09-18 09:10:43.160 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.50.62 error renewing the Reolink subscription
2022-09-18 09:10:52.606 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 123, in _update_event_range
    _, files = await self._base.send_search(start, end)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:10:52.612 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 98, in _update_event_range
    search, _ = await self._base.send_search(start, end, True)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:10:52.618 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 123, in _update_event_range
    _, files = await self._base.send_search(start, end)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:10:52.624 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 123, in _update_event_range
    _, files = await self._base.send_search(start, end)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:10:52.628 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 123, in _update_event_range
    _, files = await self._base.send_search(start, end)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:10:52.633 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/sensor.py", line 163, in handle_event
    await self._hass.async_add_job(self._update_event_range)
  File "/config/custom_components/reolink_dev/sensor.py", line 123, in _update_event_range
    _, files = await self._base.send_search(start, end)
  File "/config/custom_components/reolink_dev/base.py", line 278, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1585, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
2022-09-18 09:11:40.001 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.cam2.motion_states data
2022-09-18 09:11:59.714 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.cam3] Error from stream worker: Error demuxing stream: [Errno 110] Operation timed out: 'rtsp://admin:TesterMaster456%21@192.168.50.62:554/h264Preview_01_main'
2022-09-18 09:12:12.086 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API
2022-09-18 09:12:12.087 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event
    await self._base.api.get_all_motion_states()
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states
    response = await self.send(body)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1730, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

2022-09-18 09:12:22.679 ERROR (MainThread) [custom_components.reolink_dev] Unexpected error fetching reolink.cam3 data: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/reolink_dev/__init__.py", line 103, in async_update_data
    await base.update_states()
  File "/config/custom_components/reolink_dev/base.py", line 256, in update_states
    await self._api.get_states()
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 460, in get_states
    response = await self.send(body)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1730, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError
LordOfSteel commented 1 year ago

I have the same problem. love an answer, Has worked flawless before for me. Not sure when the problem started. HA v2022.9.5, reolink_dev v0.57 Camera: RLC-520A Firmware Version: v3.1.0.951_22041566 image_2022-09-20 203143

Tid

avbor commented 1 year ago

Cam RLC-510A (HW: IPC_523128M5MP_V2, FW: v3.1.0.801_22010700). Same here, my sensors and the camera itself become inaccessible from time to time. The problem is definitely not in credentials, because most of the time it works fine. And in this time direct rtsp stream works fine (integration Generic Camera).

image

In HA logs i have a lot of errors like this:

Logger: custom_components.reolink_dev.binary_sensor
Source: custom_components/reolink_dev/binary_sensor.py:126
Integration: Reolink IP camera ([documentation](https://github.com/fwestenberg/reolink_dev), [issues](https://github.com/fwestenberg/reolink_dev/issues))
First occurred: 01:08:54 (12 occurrences)
Last logged: 11:28:54

Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1730, in send raise CredentialsInvalidError() reolink.exceptions.CredentialsInvalidError
Logger: custom_components.reolink_dev.binary_sensor
Source: custom_components/reolink_dev/binary_sensor.py:125
Integration: Reolink IP camera ([documentation](https://github.com/fwestenberg/reolink_dev), [issues](https://github.com/fwestenberg/reolink_dev/issues))
First occurred: 01:08:54 (12 occurrences)
Last logged: 11:28:54

Motion states could not be queried from API
Logger: custom_components.reolink_dev.binary_sensor
Source: custom_components/reolink_dev/binary_sensor.py:125
Integration: Reolink IP camera ([documentation](https://github.com/fwestenberg/reolink_dev), [issues](https://github.com/fwestenberg/reolink_dev/issues))
First occurred: 01:08:54 (12 occurrences)
Last logged: 11:28:54

Motion states could not be queried from API
Logger: custom_components.reolink_dev
Source: custom_components/reolink_dev/base.py:256
Integration: Reolink IP camera ([documentation](https://github.com/fwestenberg/reolink_dev), [issues](https://github.com/fwestenberg/reolink_dev/issues))
First occurred: 01:08:24 (21 occurrences)
Last logged: 11:28:25

Unexpected error fetching reolink.ReolinkCam-01 data:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/reolink_dev/__init__.py", line 103, in async_update_data
    await base.update_states()
  File "/config/custom_components/reolink_dev/base.py", line 256, in update_states
    await self._api.get_states()
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 460, in get_states
    response = await self.send(body)
  File "/usr/local/lib/python3.10/site-packages/reolink/camera_api.py", line 1730, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError
Logger: aiohttp.server
Source: custom_components/reolink_dev/camera.py:197
Integration: Reolink IP camera ([documentation](https://github.com/fwestenberg/reolink_dev), [issues](https://github.com/fwestenberg/reolink_dev/issues))
First occurred: 10:26:46 (10 occurrences)
Last logged: 11:28:21

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 222, 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 1700, in send
    raise InvalidContentTypeError("expected '{}' but received '{}'".format(expected_content_type,
reolink.exceptions.InvalidContentTypeError: expected 'image/jpeg' but received 'text/html'
MikOsle commented 1 year ago

Hi. I'm having the same issue on my RLC-510A, Firmware: v3.1.0.951_22041567 on all 4 motion sensors. I also have a RLC-410-5MP connected the same way with no issues. image image image