fwestenberg / reolink_dev

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

Reolink RLC-511WA fw v3.1.0.956_22041509 and RLC-520A fw v3.1.0.951_22041566 #490

Open garry0garry opened 2 years ago

garry0garry commented 2 years ago

Reolink RLC-511WA fw v3.1.0.956_22041509 and RLC-520A fw v3.1.0.951_22041566 After updating to the latest firmware release, I got the following errors:

2022-04-25 08:41:30 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 526, in searchtime_to_datetime
    return dt.datetime(
ValueError: year 0 is out of range
2022-04-25 08:41:30 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.177: Failed to get results for Search, JSON data was was empty?
2022-04-25 08:41:30 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.177: Failed to get results for Search, JSON data was was empty?
2022-04-25 08:41:30 WARNING (MainThread) [reolink.camera_api] Host: 192.168.50.177: Failed to get results for Search, JSON data was was empty?
2022-04-25 08:43:21 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.cam10.motion_states data
2022-04-25 08:43:21 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.cam6.motion_states data
2022-04-25 08:43:21 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.cam8.motion_states data
2022-04-25 08:52:16 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-04-25 08:52:16 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-04-25 08:52:16 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.50.14 error renewing the Reolink subscription
garry0garry commented 2 years ago

Logger: reolink.camera_api Source: /usr/local/lib/python3.9/site-packages/reolink/camera_api.py:1605 First occurred: 08:26:52 (990 occurrences) Last logged: 21:30:10

Host: 192.168.50.63: Failed to get results for Search, JSON data was was empty? Host: 192.168.50.177: Failed to get results for Search, JSON data was was empty? Host: 192.168.50.62: Failed to get results for Search, JSON data was was empty? Host: 192.168.50.140: Failed to get results for Search, JSON data was was empty? Host: 192.168.50.27: Failed to get results for Search, JSON data was was empty?


Logger: custom_components.reolink_dev Source: helpers/update_coordinator.py:196 Integration: Reolink IP camera (documentation, issues) First occurred: 08:03:21 (275 occurrences) Last logged: 21:34:01

Timeout fetching reolink.cam8.motion_states data Timeout fetching reolink.cam9.motion_states data Timeout fetching reolink.cam7.motion_states data Timeout fetching reolink.cam2.motion_states data Timeout fetching reolink.cam11.motion_states data


Logger: custom_components.reolink_dev.base Source: custom_components/reolink_dev/base.py:416 Integration: Reolink IP camera (documentation, issues) First occurred: 08:26:45 (248 occurrences) Last logged: 21:29:01

Host 192.168.50.177 error renewing the Reolink subscription Host 192.168.50.162 error renewing the Reolink subscription Host 192.168.50.14 error renewing the Reolink subscription Host 192.168.50.72 error renewing the Reolink subscription Host 192.168.50.140 error renewing the Reolink subscription


Logger: reolink.subscription_manager Source: /usr/local/lib/python3.9/site-packages/reolink/subscription_manager.py:103 First occurred: 08:26:45 (496 occurrences) Last logged: 21:29:01

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


Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:255 Integration: Reolink IP camera (documentation, issues) First occurred: 10:09:53 (23 occurrences) Last logged: 21:19:00

Unexpected error fetching reolink.cam7 data: API returned HTTP status ERROR code 502/Bad Gateway Unexpected error fetching reolink.cam2 data: API returned HTTP status ERROR code 502/Bad Gateway Unexpected error fetching reolink.cam4 data: API returned HTTP status ERROR code 502/Bad Gateway Unexpected error fetching reolink.cam10 data: API returned HTTP status ERROR code 502/Bad Gateway Unexpected error fetching reolink.cam11 data: API returned HTTP status ERROR code 502/Bad Gateway Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 190, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data return await self.update_method() File "/config/custom_components/reolink_dev/init.py", line 98, in async_update_data await base.update_states() File "/config/custom_components/reolink_dev/base.py", line 255, in update_states await self._api.get_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 460, in get_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1714, in send raise ApiError( reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway


Logger: homeassistant Source: custom_components/reolink_dev/base.py:526 Integration: Reolink IP camera (documentation, issues) First occurred: 08:41:30 (99 occurrences) Last logged: 21:17:05

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 526, in searchtime_to_datetime return dt.datetime( ValueError: year 0 is out of range


Logger: homeassistant Source: custom_components/reolink_dev/base.py:277 Integration: Reolink IP camera (documentation, issues) First occurred: 08:26:53 (160 occurrences) Last logged: 21:18:58

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_eventrange , files = await self._base.send_search(start, end) File "/config/custom_components/reolink_dev/base.py", line 277, in send_search return await self._api.send_search(start, end, only_status) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1576, in send_search response = await self.send(body, {"cmd": command}) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1714, in send raise ApiError( reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway


Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:255 Integration: Reolink IP camera (documentation, issues) First occurred: 09:01:29 (8 occurrences) Last logged: 21:03:14

Unexpected error fetching reolink.cam8 data: Unexpected error fetching reolink.cam2 data: Unexpected error fetching reolink.cam4 data: Unexpected error fetching reolink.cam6 data: Unexpected error fetching reolink.cam10 data: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 190, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data return await self.update_method() File "/config/custom_components/reolink_dev/init.py", line 98, in async_update_data await base.update_states() File "/config/custom_components/reolink_dev/base.py", line 255, in update_states await self._api.get_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 460, in get_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1721, in send raise CredentialsInvalidError() reolink.exceptions.CredentialsInvalidError

etc.

skynet01 commented 2 years ago

I am on previous older firmware (...764..), and get all of those errors a few times a day.

RLC510 and RLC811 POE cameras

Swiftrail84 commented 2 years ago

https://github.com/fwestenberg/reolink_dev/issues/486

GewoonRoy commented 2 years ago

Any updates on this issue?

I've got the same issues with firmware v3.1.0.956 on a RLC-822A. I downgraded to v3.1.0.764 and get less errors by just like @skynet01 described i still get these errors a few times a day.

It mostly happens on motion for me. So when the camera notices motion it starts breaking.

garry0garry commented 2 years ago

@fwestenberg, do you plan to use an exception handler for these errors? After one day, the log becomes too large and unreadable.

garry0garry commented 2 years ago

HA v2022.6.6, HACS v1.25.5, reolink_dev v0.54 Errors in the last 8 hours:

Logger: homeassistant Source: custom_components/reolink_dev/base.py:277 Integration: Reolink IP camera (documentation, issues) First occurred: 16 июня 2022 г., 23:28:02 (109 occurrences) Last logged: 08:09:07 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 277, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1576, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1714, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway

Logger: custom_components.reolink_dev.binary_sensor Source: custom_components/reolink_dev/binary_sensor.py:126 Integration: Reolink IP camera (documentation, issues) First occurred: 16 июня 2022 г., 23:29:33 (91 occurrences) Last logged: 08:10:00

**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.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1696, in send async with session.post( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect return await fut asyncio.exceptions.CancelledError
    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.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1696, in send async with session.post( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.9/site-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer
    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.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1721, in send raise CredentialsInvalidError() reolink.exceptions.CredentialsInvalidError
    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.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1714, in send raise ApiError( reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
    Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 534, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.50.37', 443) The above exception was the direct cause of the following exception: 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.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1696, in send async with session.post( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.37:443 ssl:default [Connect call failed ('192.168.50.37', 443)]

Logger: homeassistant Source: custom_components/reolink_dev/base.py:532 Integration: Reolink IP camera (documentation, issues) First occurred: 16 июня 2022 г., 23:12:39 (40 occurrences) Last logged: 07:56:41 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 532, in searchtime_to_datetime
    return dt.datetime(
ValueError: year 0 is out of range

Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:255 Integration: Reolink IP camera (documentation, issues) First occurred: 16 июня 2022 г., 23:28:59 (14 occurrences) Last logged: 08:09:15

Unexpected error fetching reolink.cam9 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam7 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam5 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam6 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam2 data: API returned HTTP status ERROR code 502/Bad Gateway

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/reolink_dev/__init__.py", line 98, in async_update_data
    await base.update_states()
  File "/config/custom_components/reolink_dev/base.py", line 255, in update_states
    await self._api.get_states()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 460, in get_states
    response = await self.send(body)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1714, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway

Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:255 Integration: Reolink IP camera (documentation, issues) First occurred: 00:04:58 (8 occurrences) Last logged: 07:58:52

Unexpected error fetching reolink.cam10 data:
Unexpected error fetching reolink.cam3 data:
Unexpected error fetching reolink.cam11 data:
Unexpected error fetching reolink.cam9 data:
Unexpected error fetching reolink.cam7 data:

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/reolink_dev/__init__.py", line 98, in async_update_data
    await base.update_states()
  File "/config/custom_components/reolink_dev/base.py", line 255, in update_states
    await self._api.get_states()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 460, in get_states
    response = await self.send(body)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1721, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

Logger: homeassistant Source: custom_components/reolink_dev/base.py:277 Integration: Reolink IP camera (documentation, issues) First occurred: 04:50:15 (1 occurrences) Last logged: 04:50:15 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 277, in send_search
    return await self._api.send_search(start, end, only_status)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1576, in send_search
    response = await self.send(body, {"cmd": command})
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1721, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError
garry0garry commented 2 years ago

HA v2022.6.7, HACS v1.25.5, reolink_dev v0.54

2022-06-26 21:12:01 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 532, in searchtime_to_datetime return dt.datetime( ValueError: year 1597257008 is out of range

skynet01 commented 2 years ago

Is there any way that maybe these errors are handled more gracefully so that they don't overfill the log? There is a way to set up motion sensors manually by just using the rest sensor. As described here: https://community.home-assistant.io/t/reolink-nvr-to-home-assistant-issue/430491/2 is there a possibility to maybe use the same way to get the motion status?

arigit commented 2 years ago

I am seeing a massive amount of instances of:

Failed to get results for Search, JSON data was was empty?

from this integration, from my 3 reolink cameras. 16K log entries in 7 days. The cameras seem to be working fine. This is with HA 2022.7.3, integration v0.55. I didn't notice this issue in prior HA & integration versions, the log size was very small by comparison, after weeks of use.

garry0garry commented 1 year ago

HA v2022.8.7, HACS v1.27.1, reolink_dev v0.56. Tracebacks:

Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:256 Integration: Reolink IP camera (documentation, issues) First occurred: 1 сентября 2022 г., 00:03:13 (135 occurrences) Last logged: 07:18:09

Unexpected error fetching reolink.cam7 data:
Unexpected error fetching reolink.cam4 data:
Unexpected error fetching reolink.cam3 data:
Unexpected error fetching reolink.cam2 data:
Unexpected error fetching reolink.cam9 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: custom_components.reolink_dev.binary_sensor Source: custom_components/reolink_dev/binary_sensor.py:126 Integration: Reolink IP camera (documentation, issues) First occurred: 31 августа 2022 г., 23:17:52 (287 occurrences) Last logged: 07:17:41

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 1705, in send async with session.post( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect return await fut asyncio.exceptions.CancelledError
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
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 1723, in send raise ApiError( reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway
Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection raise exceptions[0] File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect return await fut File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.50.62', 443) The above exception was the direct cause of the following exception: 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 1705, in send async with session.post( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.62:443 ssl:default [Connect call failed ('192.168.50.62', 443)]
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 1705, in send async with session.post( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer

Logger: homeassistant Source: custom_components/reolink_dev/base.py:533 Integration: Reolink IP camera (documentation, issues) First occurred: 31 августа 2022 г., 23:16:27 (138 occurrences) Last logged: 06:51:42

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 1379168333 is out of range

Logger: custom_components.reolink_dev Source: custom_components/reolink_dev/base.py:256 Integration: Reolink IP camera (documentation, issues) First occurred: 31 августа 2022 г., 23:17:16 (92 occurrences) Last logged: 06:17:56

Unexpected error fetching reolink.cam5 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam8 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam6 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam3 data: API returned HTTP status ERROR code 502/Bad Gateway
Unexpected error fetching reolink.cam2 data: API returned HTTP status ERROR code 502/Bad Gateway
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 1723, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway

Logger: homeassistant Source: custom_components/reolink_dev/base.py:278 Integration: Reolink IP camera (documentation, issues) First occurred: 31 августа 2022 г., 23:16:27 (970 occurrences) Last logged: 06:17:02

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

Logger: custom_components.reolink_dev Source: helpers/entity.py:525 Integration: Reolink IP camera (documentation, issues) First occurred: 1 сентября 2022 г., 00:23:23 (69 occurrences) Last logged: 05:46:07

Unexpected error fetching reolink.cam6.motion_states data: Attribute hass is None for <Entity cam6 pet detected: off>
Unexpected error fetching reolink.cam5.motion_states data: Attribute hass is None for <Entity cam5 pet detected: off>
Unexpected error fetching reolink.cam2.motion_states data: Attribute hass is None for <Entity cam2 pet detected: off>
Unexpected error fetching reolink.cam7.motion_states data: Attribute hass is None for <Entity cam7 pet detected: off>
Unexpected error fetching reolink.cam11.motion_states data: Attribute hass is None for <Entity cam11 pet detected: off>
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 124, in async_update_motion_states
    await base.sensor_motion_detection.handle_event(Event(base.event_id, {"motion": True}))
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 159, in handle_event
    await self._base.sensor_pet_detection.handle_event(
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 323, in handle_event
    self.async_schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 677, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 525, in async_write_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <Entity cam11 pet detected: off>

Logger: homeassistant Source: custom_components/reolink_dev/base.py:278 Integration: Reolink IP camera (documentation, issues) First occurred: 1 сентября 2022 г., 09:50:25 (16 occurrences) Last logged: 1 сентября 2022 г., 21:40:36

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 1730, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

Logger: homeassistant Source: custom_components/reolink_dev/base.py:278 Integration: Reolink IP camera (documentation, issues) First occurred: 1 сентября 2022 г., 11:24:23 (4 occurrences) Last logged: 1 сентября 2022 г., 11:24:26

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 1705, in send
    async with session.post(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 893, in start
    with self._timer:
  File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 721, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

Logger: homeassistant Source: custom_components/reolink_dev/base.py:278 Integration: Reolink IP camera (documentation, issues) First occurred: 1 сентября 2022 г., 11:20:25 (6 occurrences) Last logged: 1 сентября 2022 г., 11:20:31

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
    await waiter
ConnectionAbortedError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

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

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 1705, in send
    async with session.post(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.50.63:443 ssl:default [None]
garry0garry commented 1 year ago

HA 2022.10.0. The same result. Too many errors without exception handling.

garry0garry commented 1 year ago

HA 2022.10.1

Logger: homeassistant Source: helpers/entity.py:526 First occurred: 02:01:49 (1473 occurrences) Last logged: 18:43:25

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 159, in handle_event
    await self._base.sensor_pet_detection.handle_event(
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 323, in handle_event
    self.async_schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 678, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 526, in async_write_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <Entity cam10 pet detected: off>
JimStar commented 1 year ago

You can try this one, and let me know if there are any errors...
https://github.com/JimStar/reolink_cctv

skynet01 commented 1 year ago

Omg your component is Sooooo much better. It actually works consistently, I may even have to get rid of the buggy Frigate setup. Is there a way to easily access the last recorded video so I can use it in notifications?