tomasbedrich / home-assistant-hikconnect

A Home Assistant integration to communicate with Hikvision smart doorbells via Hik-Connect cloud.
43 stars 10 forks source link

Version 1.2.3 still get error #26

Closed pepsonEL closed 2 years ago

pepsonEL commented 2 years ago

On latest version i still get errors:

Update of call status failed 10 times in a row
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/hikconnect/api.py", line 224, in get_call_status
    async with self.client.get(
  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
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/config/custom_components/hikconnect/sensor.py", line 63, in async_update
    res = await asyncio.wait_for(get_call_status_coro, SCAN_INTERVAL_TIMEOUT.seconds)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Update for sensor.ds_7608ni_k2_8p_c26292551_call_status fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/hikconnect/api.py", line 224, in get_call_status
    async with self.client.get(
  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
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 521, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 725, in async_device_update
    raise exc
  File "/config/custom_components/hikconnect/sensor.py", line 63, in async_update
    res = await asyncio.wait_for(get_call_status_coro, SCAN_INTERVAL_TIMEOUT.seconds)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
tomasbedrich commented 2 years ago

Hi @pepsonEL, the intent was not to silence errors completely, because that would make it very hard to eventually spot any error. It is working as expected. It counts errors and only emits a message if number of errors is >10.