core: ONVIF motion detection sensor stops working after a while

The problem

The binary_sensor, for motion detection, created by the ONVIF integration stops working after a while. After rebooting Home Assistant the sensor works again until the same issue occurs again.

Environment

  • Home Assistant Core release with the issue: 0.110.4
  • Last working Home Assistant Core release (if known): N.A.
  • Operating environment (Home Assistant/Supervised/Docker/venv): Hassio
  • Integration causing this issue: ONVIF
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/onvif/

Traceback/Error logs

Logger: homeassistant.core
Source: components/onvif/event.py:111
First occurred: 10:24:42 (1 occurrences)
Last logged: 10:24:42

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 962, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 949, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.42', 1024)

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/onvif/event.py", line 124, in async_pull_messages
    await self.async_renew()
  File "/usr/src/homeassistant/homeassistant/components/onvif/event.py", line 111, in async_renew
    await self._subscription.Renew(termination_time)
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/bindings.py", line 13, in send
    options["address"], envelope, http_headers
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 107, in post_xml
    response = await self.post(address, message, headers)
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 95, in post
    proxy=self.proxy,
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.42:1024 ssl:None [Connect call failed ('192.168.1.42', 1024)]

Additional information

My camera is a TP-Link Tapo C100. I’ve connected the camera using the UI. Information about connecting the camera using ONVIF can be found here: https://www.tapo.com/uk/faq/70/

The ONVIF service port of the camera is 2020, but in the stacktrace I see port 1024. Could this cause the issue? Or are multiple ports used?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@herrwusel I needed to enable the motion sensor from the mobile app, but I didn’t require any additional configuration in Home Assistant I think. I haven’t used my c100 with Home Assistant in a couple of months so I’m not 100% sure 😃

looks like this could be related to what I’ve discussed here https://github.com/home-assistant/core/issues/36111#issuecomment-633390203 with @hunterjm