Bug: camera is not marked as unavailable when it is disconnected
See original GitHub issueDescribe the bug When a configured camera is disconnected (from the network or it looses its power supply) the camera is still available in “Idle” state. Also the motion sensor shows the last state detected.
To Reproduce Configure a tapo camera. Once configured use it, use pan, tilt, motion detection Disconnect the power supply or switch off the access point so the camera is no longer available.
Expected behavior A conservative time-out could be used to change the availability of the camera and update its state (don’t know if it happens with other cameras). The sensor could update to unavailable state like other integrations do with devices that stopped communicating with HA, so we can trigger an automation and generate a notification
Log
2021-03-11 09:13:59 ERROR (MainThread) [custom_components.tapo_control] Unexpected error fetching Tapo resource status data: [Errno 113] Connect call failed ('192.168.1.146', 2020)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/httpx/_exceptions.py", line 326, in map_exceptions
yield
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1502, in _send_single_request
(status_code, headers, stream, ext,) = await transport.arequest(
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 218, in arequest
response = await connection.arequest(
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection.py", line 93, in arequest
self.socket = await self._open_socket(timeout)
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection.py", line 119, in _open_socket
return await self.backend.open_tcp_stream(
File "/usr/local/lib/python3.8/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream
return await self.backend.open_tcp_stream(
File "/usr/local/lib/python3.8/site-packages/httpcore/_backends/asyncio.py", line 270, in open_tcp_stream
return SocketStream(
File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.8/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc) from None
httpcore.ConnectError: [Errno 113] Connect call failed ('192.168.1.146', 2020)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 149, in async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _async_update_data
return await self.update_method()
File "/config/custom_components/tapo_control/__init__.py", line 152, in async_update_data
await syncTime(hass, entry)
File "/config/custom_components/tapo_control/utils.py", line 202, in syncTime
await device_mgmt.SetSystemDateAndTime(time_params)
File "/usr/local/lib/python3.8/site-packages/zeep/proxy.py", line 64, in __call__
return await self._proxy._binding.send_async(
File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 156, in send_async
response = await client.transport.post_xml(
File "/usr/local/lib/python3.8/site-packages/zeep/transports.py", line 230, in post_xml
response = await self.post(address, message, headers)
File "/usr/local/lib/python3.8/site-packages/zeep/transports.py", line 215, in post
response = await self.client.post(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1633, in post
return await self.request(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1371, in request
response = await self.send(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1406, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1444, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1476, in _send_handling_redirects
response = await self._send_single_request(request, timeout)
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1502, in _send_single_request
(status_code, headers, stream, ext,) = await transport.arequest(
File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.8/site-packages/httpx/_exceptions.py", line 343, in map_exceptions
raise mapped_exc(message, **kwargs) from exc # type: ignore
httpx.ConnectError: [Errno 113] Connect call failed ('192.168.1.146', 2020)
Camera (please complete the following information): Device info C200 by TP-Link Firmware: 1.0.10 Build 200520 Rel.45325n(4555)
Using stream component [yes/no] NO
Camera works through onvif component OR different cameras work in general [yes/no] YES
Camera has all attributes filled out properly in developer tools [yes/no - provide more info] YES
HASS Environment Supervised environment: Home Assistant core-2021.2.3 Home Assistant OS 5.12 Supervisor Version | supervisor-2021.03.4
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
(edit) Ignore the previous messages, it started behaving well after some HA restarts while tuning the noise sensitivity (very strange, for a couple of days it didn’t refresh the status) Excuse me for reviving an old thread…
Implemented in 3.2.2, thank you for suggestion!