[Custom Component] Tapo: Cameras Control

Hey, that error is a valid error, when you have privacy mode turned on, you are not able to control PTZ and some other functions until the privacy mode is disabled.

Update happens as soon as you trigger any command to camera or every 10 seconds.

If you haven’t yet, check examples for lovelace cards or examples for template entities.

I am doing something similar - automatically turning cameras via ptz and setting privacy when I get home or go away, see https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/blob/e719a75b629e81fc2163d30f47951b814d33ac41/examples/EXAMPLES_LOVELACE.md#picture-glance-with-live-view-and-scripts-tap-and-hold-actions for my usage.

1 Like

Ah ok maybe that error is the switch trying to turn ptz preset on before the camera is out of privacy mode. The problem is that it stops the rest of the script or automation from continuing. I’m doing pretty much the same as you, so you will have the same issue if someone turns on privacy mode before you run set_bedroom_camera_home. I guess for that example it’s not going to happen as you’re away but I wanted it to be foolproof for maybe when I set them to on at night and someone turns the privacy mode back on.

Yes that is true, but I am exposing only those 2 buttons in hass, so there is no way to reach that scenario :slight_smile:

Hello all,
this is a wonderful thread, however I’m not able to customize a Lovelace card with the services created after the installation of the Tapo HACS component. I’d like to inserte glances in my camera view, but no way to get it work.
For example, the tapo_control.ptz works well from Developers Tools -> services, but from a Lovelace card configuration I always get the following error: Visual editor is not supported for this configuration:
The provided value for “entities.0” is not supported by the visual editor. We support (Object<{entity,name,icon,image,secondary_info,format,state_color,tap_action,hold_action,double_tap_action}> | string | Object<{type,name,action_name,tap_action,hold_action,double_tap_action}> | Object<{type,view,dashboard,name,icon,hide_if_unavailable}> | Object<{type,row,conditions}> | Object<{type,style}> | Object<{type,label}> | Object<{type,url,name,icon}> | Object<{type,entities}> | Object<{type,entity,attribute,prefix,suffix,name}> | Object<{type,name,service,icon,action_name,service_data}>) but received ({“entity”:“camera.garage_hd”,“icon”:“mdi:arrow-left-drop-circle-outline”,“tap_action”:{“action”:“call-service”,“service”:“tapo_control.ptz”}}).

I’ve also tried to edit the configuration.yaml, but it seems that entities are not accepted.
I get the following errors when validation the configuration.yaml:

Component error: entities - Integration ‘entities’ not found.
Component error: camera_view - Integration ‘camera_view’ not found.
Component error: camera_image - Integration ‘camera_image’ not found.

Would somebody be so kind to point me where I’m wrong?
Thanks

Hello,

you are mixing configuration.yaml with lovelace stuff. Those are separate systems.
Not everything is supported by visual editor, then you need to edit it through yaml (via UI, not configuration.yaml). That is expected and I get the same, you just need to edit it via yaml, once you save it it should work.

You will need to learn how lovelace works and what configuration is for.

After you are done with that, some working examples for lovelace are listed here: https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/blob/10e95b2b3d6c8595cf20d37f4d9c990fa961a704/examples/EXAMPLES_LOVELACE.md

Thanks Juraj, however this is not fully clear to me. I installed HA Core and from Lovelace I do see the following editor:


The last message refers to YAML editor, but I’m not able to find it.

If you copy the code from post 102 into a blank card (manual) and change ALL the entities to your camera entity it will work…I’ve done it myself.

Also your card is a picture entity and it should be a “picture glance” card

Silly me! It works like a charm…
I’ve always started from a predefined Picture entity card, instead of a manual one.
Thanks Marc, you made my day!

First of all: Greate work on this integration!!!

Can someone help me on this?

The HD preview works for some time and than it break.

“Use Stream from Home Assistant” is disable.
I have Home Assistant in a Intel i5 with 16gb Ram and 256GB SSD, so I don think that the problem is the clock.

I’m getting 2 erros in logs:

Error handling request
1:33:30 – custom_components/tapo_control/camera.py (ERROR)

Logger: aiohttp.server
Source: custom_components/tapo_control/camera.py:209
First occurred: 1:33:30 (1 occurrences)
Last logged: 1:33:30
Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 422, in _handle_request
resp = await self._request_handler(request)
File “/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py”, line 499, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py”, line 118, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 56, in security_filter_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 18, in request_context_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 72, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 127, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 129, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/camera/init.py”, line 502, in get
return await self.handle(request, camera)
File “/usr/src/homeassistant/homeassistant/components/camera/init.py”, line 537, in handle
return await camera.handle_async_mjpeg_stream(request)
File “/config/custom_components/tapo_control/camera.py”, line 209, in handle_async_mjpeg_stream
await stream.close()
File “/usr/local/lib/python3.8/site-packages/haffmpeg/core.py”, line 158, in close
await self._loop.run_in_executor(None, _close)
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.8/site-packages/haffmpeg/core.py”, line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

1:15:01 – Tapo: Cameras Control (ERROR) - a mensagem ocorreu pela primeira às 1:13:34 e apareceu 5 vezes

Logger: custom_components.tapo_control
Source: custom_components/tapo_control/init.py:209
Integration: Tapo: Cameras Control (documentation, issues)
First occurred: 1:13:34 (5 occurrences)
Last logged: 1:15:01
Unable to connect to Tapo: Cameras Control controller: HTTPSConnectionPool(host=‘192.168.68.152’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f0f00370040>: Failed to establish a new connection: [Errno 113] Host is unreachable’))
Unable to connect to Tapo: Cameras Control controller: HTTPSConnectionPool(host=‘192.168.68.152’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f0efd4df5b0>: Failed to establish a new connection: [Errno 113] Host is unreachable’))
Unable to connect to Tapo: Cameras Control controller: HTTPSConnectionPool(host=‘192.168.68.152’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f0efc65fbb0>: Failed to establish a new connection: [Errno 113] Host is unreachable’))
Unable to connect to Tapo: Cameras Control controller: HTTPSConnectionPool(host=‘192.168.68.152’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f0efc63fe80>: Failed to establish a new connection: [Errno 113] Host is unreachable’))
Unable to connect to Tapo: Cameras Control controller: HTTPSConnectionPool(host=‘192.168.68.152’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f0efcac95e0>: Failed to establish a new connection: [Errno 113] Host is unreachable’))

Hello,

That means your camera went offline. Make sure yo update to latest firmware. If issue persists, check your network connection, restart the camera and try to debug yourself. There’s not much how anyone can help you with this unfortunately.

1 Like

I would completly agree with you if the SD entity also break, but it remails normal, showing the video.
Any other idea? While that I keeps troubleshooting.

Hmmm… camera can go offline on multiple services / ports independent on each-other:

  • 443 for control
  • 554 RTSP for streams
  • 2020 for onvif
  • and the last one which is not being used and I do not remember… but that one is used for streams via official app
1 Like

Version 3.2 ✐

Description

This release adds a support for new UI for services in automations, scripts and developer tools introduced in Home Assistant 2021.3.0.

It makes it super easy to use any services provided by this integration for everyone.

Breaking changes

None.

3 Likes

Works nice with my C200 camera but what I see is when using the camera output on different views it seems to exceed user limit for my camera. Even on switch views or close other views it is exceeded until I restart the camera. Is there a way to close a connection? Or share the camera views? I think the limit is 4 simultaneous views. And usually I have 2 Views in HA using the camera and sometimes for testing I use the tape app.

@JurajNyiri I investigated my problem if cam is not on same network (range). I will be discovered by hass but integration still fails to integrate with unknown error. I made port forwarding on my roouter (Dream Machine) maybe someone else facing this and found a solution?

This is handled by Home Assistant, integration just passes stream to Home Assistant.

AFAIK Home Assistant should only create one proxy stream for camera. You can try disabling entities with SD stream and see if it helps.

Version 3.3.0 :loud_sound:

Description

This release adds a support for noise detection as requested in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/71 .

You will need to enable this when adding the camera, or via options on existing cameras. When enabled, integration will analyse sound from camera stream in realtime and update a new attribute noise_detected to on, or off. This attribute is available only when noise detection is enabled and was initiated.

This expands possibilities of this camera, you could for example trigger an alarm based on noise or use the camera as baby monitor.

Breaking changes

None.

4 Likes

Great update, guess I’ll add some notifications based on noise detection. This custom component has been great and makes me really happy with my camera choice.

I’ll have to ask, is there any chance of these Tapo cameras having a illuminance sensor? I’ve been wanting to trigger lights based on room brightness.

Hey,

no there is no such sensor exposed. There was an issue about it and the conslusion was that camera has to calculate brightness from the stream.

1 Like