reolink_dev icon indicating copy to clipboard operation
reolink_dev copied to clipboard

ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API

Open garry0garry opened this issue 2 years ago • 5 comments

HA 2022.3.8, HACS 1.24.3, Home Assistant Reolink addon 0.51 Reolink RLC-520A fw 3.1.0.764_21121700

36 records for 11 hours:

2022-04-04 20:53:34 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-04-04 20:53:34 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.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

garry0garry avatar Apr 04 '22 18:04 garry0garry

binary_sensor.cam_person_detected in HA is displayed very rarely. There were no big problems with the binary_sensor.cam_motion.

HA 2022.4.6, HACS 1.24.5, Home Assistant Reolink addon 0.52 RLC-511WA fw v3.1.0.764_2112170

`2022-04-24 19:26:35 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-04-24 19:26:35 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] 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 1056, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.50.27', 80)

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.27:80 ssl:default [Connect call failed ('192.168.50.27', 80)]`

garry0garry avatar Apr 24 '22 16:04 garry0garry

Hi,

This error message clearly indicates that the camera refuses connections on port 80

On Sun, Apr 24, 2022, 18:56 garry0garry @.***> wrote:

binary_sensor.cam_person_detected in HA is displayed very rarely. There were no big problems with the binary_sensor.cam_motion.

HA 2022.4.6, HACS 1.24.5, Home Assistant Reolink addon 0.52 RLC-511WA fw v3.1.0.764_2112170

2022-04-24 19:26:35 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-04-24 19:26:35 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] 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 1056, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.50.27', 80)

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.27:80 ssl:default [Connect call failed ('192.168.50.27', 80)]

— Reply to this email directly, view it on GitHub https://github.com/fwestenberg/reolink_dev/issues/482#issuecomment-1107878224, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTC5PWXGUXKD5W3LZ5NT5TVGV4KVANCNFSM5SQM6YGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cpainchaud avatar Apr 24 '22 16:04 cpainchaud

binary_sensor.cam_motion is available on port 80, but binary_sensor.cam_person_detected is not?..

garry0garry avatar Apr 24 '22 17:04 garry0garry

Depending on the scenario, it might be refreshed via the On if. Also I cannot exclude a crash on second API call that would in return create a connection refused but that is still an indication of an external issue. That error message is not produced by the integration but by HA's AioHTTP instance. There can be no confusion.

On Sun, Apr 24, 2022, 19:15 garry0garry @.***> wrote:

binary_sensor.cam_motion is available on port 80, but binary_sensor.cam_person_detected is not?..

— Reply to this email directly, view it on GitHub https://github.com/fwestenberg/reolink_dev/issues/482#issuecomment-1107881637, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTC5PRVJGGYMII57ZT3JWTVGV6SVANCNFSM5SQM6YGQ . You are receiving this because you commented.Message ID: @.***>

cpainchaud avatar Apr 24 '22 17:04 cpainchaud

Is this a different error?

2022-04-24 21:24:27 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.cam10.motion_states data
2022-04-24 21:24:57 ERROR (MainThread) [custom_components.reolink_dev] Unexpected error fetching reolink.cam5 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

garry0garry avatar Apr 24 '22 18:04 garry0garry