[Custom Component] Tapo: Cameras Control

Thanks a lot, guess I’ll look into a dedicated sensor!

great! this is exactly what i needed! thanks a lot!

edit: i can’t see an option in my tapo app to enable sound detection. Am i overlooking this or is it maybe not supported on my cam? (c200. hardware version v1.0 firmware 1.0.17

You enable it via integration options, not tapo app.

Make sure to be on the latest version of integration and to restart Home Assistant after enabling this option and saving.

1 Like

awesome! thanks man :smiley: works like a charm.

Hello,

I tried to install your famous add-on in my Home assistant but without success.
First of all, I installed the module from the install button from HACS / Integrations / Tapo: Cameras Control, then restart Home Assistant.
Then, I search “Tapo” into Configuration / Integrations but i can’t find it.

Can you help me ?

Hey, refresh your browser, go to config / integrations and click the plus sign and search there.

Yep, it’s works !
Thank you so much.

Have a nice day.

Hi everybody, i don’t understand if tp-link c200 has ptz enabled with this component? if not, wich indoor camera has them? i’m getting crazy

Hello, yes it does.

thanks, so with c200 and this component ( https://github.com/JurajNyiri/HomeAssistant-Tapo-Control#services ) i can use tapo_control.ptz and it works?

Hello, yes you can.

1 Like

Hi, first thanks to have developed this addon, it is very nice.
I don’t know exactly what happen but my motion sensor is now unavailable for all my camera and I do confirm that it was working few weeks ago.
image
My other problem is I wanted to activate the sound detector for baby monitoring but even if activated, I still only have 3 entities : cam hd/sd, motion sensor (unavailable).
Do you know how I can solve that ?

Hello!

motion sensor is now unavailable

Read FAQ.

sound detector … if activated, I still only have 3 entities

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 on your camera entities. I will need to update readme to also include instructions regarding the sound detection.

Ok thanks, it was not so clear to me that it was an attribute. I created this binary sensor, it seems to work:

- platform: template
  sensors:
    camera_hugo_noise_detected :
      device_class: motion
      value_template: "{{ states.camera.tapo_camera_chambre_hd.attributes.noise_detected == 'on' }}"

Regarding motion sensor, it is not so clear what happen, I reset the motion mode from the app and it looks ok now.

@JurajNyiri thank you for this effort, this is an outstanding camera integration. I needed to add a baby monitor cam and wanted one that had great compatibility with HA, that was open out-of-the-box and landed on a tapo c200, really impressed so far.

Basic integration with HA took 5 minutes, and customization (pan/tilt controls, adding a link to VLC for and HD stream) took maybe 1-2 hours. I’ll use this forever so a good time investment :slight_smile:

One challenge I had to work-around that may help others starting the streaming camera journey with HA is that using “Live Streams” with HA has a huge CPU penalty which can easily kill a Raspberry Pi (I use HA on RPi3b), the stream goes from the camera to your Home Assistant and then from there it is streamed to the browser/app. I thought that the stream would come directly from the camera to the browser, without having to go through HA. Further, the stream from the camera gets “re-encoded” in your HA CPU, and with Tapo cameras, the re-encoded output has 2 or 3 more throughput than the original stream coming from the camera (e.g. a tapo HD RTSP stream peaks at 1.5Mbps, whereas the same HD stream coming from HA GUI uses almost 5Mbps)

If you configure your picture-glance or picture-entity with “camera_view: live” and use the HD stream, I found that the RPi would eventually stall badly and become unresponsive in 10-20 minutes. Bottom line, my workaround to make my RPi bullet-proof again (it had been running for 7 months with no reboots prior to this) was the following:

  • In this custom component, disable the HD Entity (to avoid firing it up by mistake) and risking stability
  • Install VLC in your Mac/PC/android
  • Use picture-glances for the cam visualizations, without adding camera_view
  • In picture-glances, you can easily add an icon (e.g. right besides your tilt/pan controls) that when tapped will open the Tapo cam HD stream on VLC (getting the stream straight from the camera), like so:
          - entity: camera.tapo_camera_xxxx_sd
            icon: 'mdi:cctv'
            tap_action:
              action: url
              url_path: !secret camera1rtspURL

This works fine for me in linux, mac and android.
CPU utilization in the RPi went back to almost zero.

2 Likes

Hey! :slight_smile: Add “stream” to you config and make sure to enable stream in integration options (on by default)

Causes a delay of around 10sec but no longer high cpu usage!

1 Like

This works like charm. Thank you!

For 1 Tapo, CPU from

To this:

Response time became faster (compared to 8 - 10 seconds delay before)

Just for the record, adding the “stream:” integration in the my config and allowing this Tapo integration to use it, did eliminate the high CPU problem, but it added an 8 second lag (compared to the 2 second lag that I get when streaming directly from the cam)

Streaming SD from the cam via HA creates a flow from HA to the client of around 100-150Kbps which is the same as when streaming straight from the cam to VLC, so clearly there is no longer any re-encoding, just a video transport conversion.

FWIW I noticed a problem with lovelace in firefox - once you click on the cam image and get the live stream window (more-info) or if you setup “camera_view: live” in lovelace, and you navigate to the tab where you have your picture-glance and the stream starts, even if you navigate away back to the home page where there are no cameras on display, the stream from HA to the browser client stays on, curiously, forever, or at least for more than the 15minutes that I tested (firefox browser, linux), uselessly using HA CPU cycles and bandwidth for a stream that is not being watched. In my tests, this “unwatched” stream only stops when one does a full reload of the page in firefox. Curiously when doing the same on the Android app, the stream does stop immediately when one navigates away from the tab that has the cameras with live view

So to minimize the risk of useless streaming from my RPi server, and also to work-around the 8s lag, I left the configuration as-is: still-image display (refreshed every 10s, although hopefully this can be reduced to 3s or 5s, I am trying to find a way); then when clicking the image (more-info) I get the SD live stream with almost no CPU impact and minimum bandwidth and 8s lag, and lastly I have an icon on picture-glance that when clicked, opens the HD stream directly on VLC, bypassing HA and also having only 2s lag, this is the last icon in the image below.

image

I’m back regarding the new feature noise_detected. I tried to play on the setting but never found a proper way to make it working. When I reboot home assistant, there is some false trigger for a moment, and then nothing. How can I visualize the sound level of the camera ?
I’m using a tapo c100, I don’t know if it is compatible ?

Hey I was testing it on C200 and with level of -50 when I was speaking it picked it up and when it was quiet it was off. Code is based on https://www.home-assistant.io/integrations/ffmpeg_noise/ .

As for realtime value, there is no such thing, internally it uses ffmpeg with following arguments:

command = ["-vn", "-filter:a", "silencedetect=n={}dB:d=1".format(self._peak)]

(haffmpeg sensor.py line 52).

You could try running the ffmpeg manually outside of home assistant and experiment that way, might be quicker then restarting hass.

It should work on C100 if the stream includes audio (not sure about that)

Edit: From documentation on ffmpeg_noise:

ffmpeg -i YOUR_INPUT -vn -filter:a silencedetect=n=-30dB:d=1 -f null -