question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: camera is not marked as unavailable when it is disconnected

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
forast3rcommented, Feb 2, 2022

Just to clarify, so you disconnect the camera and the state stays always at idle?

(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…

1reaction
JurajNyiricommented, Mar 12, 2021

Implemented in 3.2.2, thank you for suggestion!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix 'No Available Camera Input' Error – Snap Camera
1. Restart the Video Chat Software and the Snap Camera. Some bugs can be easily fixed by shutting down the app and relaunching...
Read more >
How to solve 'There is no connected camera' error on your Mac
How to fix it when the camera is not working · 1. Update software · 2. Check Permissions · 3. Turn off Screen...
Read more >
Camera doesn't work in Windows - Microsoft Support
Some laptops and portable devices have a physical switch or button that turns the camera on or off. When it's turned off, your...
Read more >
How to Fix “Unfortunately, Camera Has Stopped” On Android
Why Android camera stops working or shows error? · Low storage space in your phone · Incomplete Android update · Bug or virus...
Read more >
Camera or webcam not working or cannot turn on in Windows ...
Solution · Confirm the PC has a built-in camera · Make sure camera slider is open · Check for a protective seal ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found