[Custom Component] Tapo: Cameras Control

hi
I have install tapo camera with hassistant core 116 on python 3.7.3 and it work well,
but when i migrated
to python 3.8.6
and reinstall homeassistant
and restore old configuration
only tapo camera control fail
in log i found
R (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration tapo_control: No module named ‘zeep.asyncio’

can help me
thanks

You will need to install this module via pip

I’m just in the market for a new cam, and this component might sway me into direction of Tapo.

I have one question - if I understand it correctly, you can’t control cam PTZ on-the-fly, but you can point it to any of the presets that you might have defined?

Hello,
You can also send right, left, up and down command. And you can set how much it shall turn when it get the command.

Integration does not currently work with Home Assistant 0.116.3. Official onvif also does not work.

This seems related to https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/30 and https://github.com/home-assistant/core/issues/41886 .

Lets see if it gets fixed on Home Assistant side, if they fix in onvif integration I will follow.
For now use 0.116.2

Edit: Now works on 0.116.3! As a side effect, it also fixes the official onvif integration.

3 Likes

Version 2.1.1 has been released. Includes a fix for Home Assistant 0.116.3.

As a side effect, this also fixes the official onvif integration because of how dependencies are handled in 0.116.3. Your results may vary on this though, only tested on HassOS on rpi.

2 Likes

I updated from 0.116.2 to 0.116.4 though still on 2.1, and the problem was fixed - I still see my camera and no error reported like before.

Not sure if I should update to 2.1.1 or leave it.

You can update to 2.1.1.

1 Like

Done, and I think it’s ok so far

Hm, I don’t know how I missed that. Thank you, it works as expected now😊

Version 2.2 :sunglasses: has been released!

This release is all about the quality of life improvements.

New features

  • Change authentication data and other options via Tapo Integration Options.
  • Disable / Enable camera entities via Home Assistant entity manager (make sure not to disable motion sensor via entity, check troubleshooting if you did).
  • Disable / Enable motion detection (= the whole onvif connection) via Tapo Integration Options.

No reboot required!

Other minor changes and fixes

  • When an error occurs while adding or updating the camera in integration page, the inputs do not lose entered values
  • Other minor fixes

Pictures


4 Likes

Superb work. The speed at which you have built and evolved the functionality of this component is really impressive.

1 Like

Just installed this. OnVif wouldn’t give me all the options, so i gave it a try a few minutes ago from HACS.

It was very straight forward. Very easy to test since there were examples on how to create your cards.

Few things im not sure is are suposed to be like that, or if it is only my lack of knowledge about how Home-assistant services:

  1. You can save and delete presets, but can’t figure out how to use them.
  2. Don’t really know if it was supposed to be possible to view the saved movies.

Thank you for this.

@MacXatu

Here’s an example…

Move the camera to where you want and use developer-services to call the preset save service e.g.:

service: tapo_control.save_preset
entity: camera.living_room

Service Data (YAML, optional)

entity_id: camera.living_room
name: centred

Now move the camera somewhere else, lets say top left, and use developer-services again to call the preset save service e.g.:

service: tapo_control.save_preset
entity: camera.living_room

Service Data (YAML, optional)

entity_id: camera.living_room
name: topleft

Now to move back to the centre you can call the tapo control ptz service with the anme of the preset you want to move to e.g.:

service: tapo_control.ptz
entity: camera.living_room

Service Data (YAML, optional)

entity_id: camera.living_room
preset: centred

You can of course use the service in automations.

Hope that helps?

2 Likes

Thanks for the fast answer.

Unfortunately my python skills don’t go much further then single file scripts to slurp stuff from the web.

I’m already very happy as it is. Keep it up.

to save video I use the following automation:

- id: '1602939186545'
  alias: Record Front Garden Motion
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.front_camera_motion
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: camera.record
    data:
      filename: /media/frontgarden/fgmotion_{{ now().strftime('%Y-%m-%d-%H-%M-%S')
        }}.mp4
      duration: 30
      lookback: 5
    entity_id: camera.front_camera_hd
  mode: single

NB: the above example has been edited to reflect the corrections mentioned below by @JurajNyiri and is working

Word of warning though there is an issues with streams (not @JurajNyiri’s excellent component) at present that means sometimes the stream fails and you only get a few seconds of video recorded.

you can then access the videos through the media share (I use windows so I just have the samba add on installed to make it available)

1 Like

Nice guide.

One slight correction, to move to preset you use property “preset”, not “name” in the ptz service.

@tachikoma1373 the recording is really an interesting use case. It has a disadvantage though compared to tapo that it happens on Home Assistant and there is no pre-record time (not sure if there is any on tapo camera). Until we have a way how to get the recordings from tapo itself it is a nice workaround!

Edit: This gave me an idea… once I figure out how to get the recordings, I might just make a service which downloads them to hass similarly to how record works. It could run periodically if enabled and sync / move the recordings.

1 Like

@tachikoma1373 I just noticed, in your automation, you are using attribute motion_detection which is not correct and will not work. Its value is related to if motion detection is enabled or not. You need to use the binary sensor to detect motion… please edit your post so that it doesn’t confuse people in the future.

thanks - I could have sworn it was working but on investigation, you guessed it, it wasn’t :slight_smile:

well thats tomorrows tasks sorted :slight_smile:

Fixed the previous post as well

Hi,

I have just implemented the camera image in picture example for my camera and it works, but there is a noticeable lag with the stream feed (several seconds).

I set up the card with hd quality, but I don’t think it’s an issue with speed: the video on the tapo app, which as far as I am concerned goes to a remote server back to my phone, has almost no lag.

The commands issued from HA instead are executed almost instantly, but with the lag in the stream it takes a while before noticing any change.