[Custom Component] Tapo: Cameras Control

Yes it does support auto tracking, check readme.

The delay is around 6 seconds and you will get it with every camera in home assistant. It’s not component related.

Hi
Is it possible to save/record the videos when motion detected?
Thanks

Could this be an option?

Hello,

Yes, https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/40#issuecomment-731750934

3 Likes

Hey thanks for this integration, it works nicely :slight_smile: Only issue is that using the stream component in HA I get a freaking big lag between lovelace and the camera feed.

Without it and using the ffmpeg component it works better however the lovelace card stops working after a while, it doesn’t show anything, just a little box like it doesn’t find any image.

Anyone else having this issue?

Hey, by using the ffmpeg you mean this - https://www.home-assistant.io/integrations/camera.ffmpeg/ ?

I tried with that and I get the same delay on both.

The delay issue is well known on Home Assistant and there is nothing I can do from integration side unfortunately.

When you disable stream component completely, the delay is a lot better but has other issues

I am currently working on a way to reduce delay by adding ability to NOT use Home Assistant stream component.

I am doing some testing to provide good and valid instructions for users.

If you guys wish to test it right now, the new version is available at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/next - it will be released very soon after my testing is done.

Edit: Released 2.4.1.

1 Like

Version 2.4.1 :rocket:

Description

This release adds an option for a user to choose to use stream component which when disabled, might provide a lot shorter playback delays for some users at a cost of higher CPU usage. Defaults to enabled.

There are advantages and disadvantages to both.
Enabled - Bigger delay, lower CPU usage, but player has an ability to stop, rewind etc. This is the default and recommended behaviour of Home Assistant if stream is enabled in configuration. More info: https://www.home-assistant.io/integrations/stream/
Disabled - A lot shorter delay, higher CPU usage, but no controls over playback.

Addresses issues https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/54 and https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/37.

This is a known issue of Home Assistant.

There might be some disadvantages to doing this, like losing option to control playback and a higher CPU usage.
Results depend on your hardware and future Home Assistant updates.

If you disable stream and your hardware is not up to the task, you will get artifacts, bigger delay and freezes.

Try it out and see what works best for you.

If you encounter any issues worth mentioning in readme while not using a stream component for the camera, please report them via a new issue or a PR.

Breaking changes

None. Your settings will be automatically migrated properly and the behaviour of the camera stays the same.

3 Likes

I have switched off stream for all my cameras with 2.4 on my RPI 4 and the delay is significantly better, around a second. What is awesome is that in my picture-glance card I am still getting live view just like before.

Let’s see what (if any) disadvantages doing that brings. :thinking:

I encourage everyone annoyed by the long delay doing that too and reporting issues / disadvantages / results here or via a new issue on github.

Edit: Switched back, having 3 cameras without stream killed my CPU and delay was back, along with freezes and artifacts. It was working fine for 1 camera.

3 Likes

Thanks for your reply, I’m indeed using that integration. To do so, I declare ffmpeg: in configuration.yaml and that’s it.

Using this integration it runs fin on my RPI4 4Gb with 1 camera, gonna buy 2 more :slight_smile:

In terms of CPU, just checked and with 1 I get about 12%CPU used only by ffmpeg, so yeah the issue can maybe crap everything out is only using ffmpeg.

However for the lag, I get more than a second of difference. With ffmpeg I get no lag, with stream I get between 3sec to almost 10sec :S

FYI, I’m using debian 10 and docker for HA, not HAS OS.

EDIT/// Go to know, the CPU craps out only if there is someone using the app to visualize the camera.

Uncheck this in Integration options on the latest version (just released 2.4.1).


Configuration -> Integrations -> Tapo Cameras Control -> Choose entity -> Options

You should get very similar playback to ffmpeg with that disabled, but your CPU usage will be higher.

Make sure to restart after unchecking and saving.

1 Like

Yeah same as ffmpeg. Gonna try to live with the stream from HA instead of ffmpeg and see. Since I’m not always looking at my cameras, a bit more CPU shouldn’t be an issue ^^’

Whatever works for you :slight_smile:

Just to clarify, these are the results you are seeing right?

  • Using stream: Low cpu usage
  • Not using stream (using ffmpeg): High cpu usage

Yup exactly. This may not be an issue when using a bigger CPU like a NUC or a server though.

1 Like

It’s like this man can read my mind:

I gave up trying to link my C200 to HA after I saw that I could only get a still image in HA and nothing else (like ptz or motion detection).

I just came across this project, will definitely give this a try.

Thanks a lot for putting effort into this @JurajNyiri ! It looks very promising and complete :+1:

2 Likes

Great job @JurajNyiri
I have low CPU usage with my intel NUC, but it seems I have less video quality.

1 Like

If we want to switch back from FFMPEG via the Integrations panel we must first killall ffmpeg for the integration to be able to validate the user/pass otherwise we cannot change it back… just a heads up or even YRMV (maybe just my setup).

On an i5 intel laptop running hass in docker FFMPEG was using 4 cores at 50% for 3 Tapos… for me not worth it for 5 seconds of latency so I went back to non-FFMPEG.

Thank you so much for this Integration too! It was the reason I bought these too!

1 Like

Hey sorry everyone I keep having the same problem, I’ve followed the guide but I cannot get a feed from the camera, it keeps saying Inactive in the image entity, if I use with vlc rtsp://USER:[email protected]:554/stream1 it works fine. Oddly the motion entity (binary_sensor.mymotiondetectorrule_cell_motion_detection) auto-installed by the integration gets movement if I put my hand in front of the lens but can’t get feed. Any ideas?

Hey, are there any errors in log?

I’ve deleted the log file and started HA again, this is all is shows by filtering the camera word in the log file:

2021-01-24 09:34:02 INFO (SyncWorker_3) [homeassistant.loader] Loaded camera from homeassistant.components.camera
2021-01-24 09:34:03 INFO (MainThread) [homeassistant.setup] Setting up camera
2021-01-24 09:34:03 INFO (MainThread) [homeassistant.setup] Setup of domain camera took 0.1 seconds
2021-01-24 09:34:04 INFO (MainThread) [homeassistant.components.camera] Setting up camera.onvif
2021-01-24 09:34:04 INFO (MainThread) [homeassistant.components.camera] Not adding entity Lounge Camera - minorStream because it's disabled
2021-01-24 09:34:07 INFO (MainThread) [homeassistant.components.camera] Setting up camera.tapo_control
2021-01-24 09:34:03 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.
2021-01-24 09:35:10 ERROR (MainThread) [haffmpeg.core] FFmpeg fails [WinError 2] Impossibile trovare il file specificato (Unable to find)
Traceback (most recent call last):
  File "C:\Users\root\AppData\Roaming\.homeassistant\deps\Python38\site-packages\haffmpeg\core.py", line 136, in open
    self._proc = await self._loop.run_in_executor(None, proc_func)
  File "C:\Users\root\AppData\Local\Programs\Python\Python38-32\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\root\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\root\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato
2021-01-24 09:35:10 WARNING (MainThread) [haffmpeg.tools] Error starting FFmpeg.

Last exception keeps going over and over again in the logfile.
I’m quite new to HA but I suppose ffmpeg is what I need to play the camera feed. Don’t actually know how to fix this. Running Core on Windows.