[Custom Component] Tapo: Cameras Control

Camera uses ONVIF standard to communicate motion events. This communication can work with 2 ways:

  1. Pullpoint: Client opens connection to the camera and waits until the camera responds. Camera responds only when there is some event to communicate. After camera responds, client reopens the connection and waits again.
  2. Webhook: Client tells the camera its URL to receive events at. When an event happens, camera communicates this to the URL client defined.

Webhooks are the preffered method of communication as they are faster and lighter. That being said;

  • Webhooks require an HTTP only HA setup because Tapo cameras do not support HTTPS webhooks
  • Webhooks require a proper base_url to be defined in HA, so that the URL communicated is correct (you can check URL sent by enabling debug logs for homeassistant.onvif)

Points above are automatically determined by this integration and if the HA does not meet the criteria, webhooks are disabled. That being said;

  • There are camera (and/or firmwares) which freeze when both webhooks and pullpoint connection is created, which happens at the start to see if webhooks is supported at all so that communication can fallback back to pullpoint.
  • There are camera firmwares which have pullpoint broken (1.3.6 C200) and only webhooks work

For webhooks to work, all the user needs to do is make sure he is using HA on HTTP and that the HA is available on the URL communicated.

Hi, I recently updated into the latest version, it worked fine but I noticed it increases the cpu usage up to 6% (before the update, idle cpu usage around 8% and now after the update, it became 14%). When I disabled the integration (all cameras) the cpu usage became normal. Is it the additional motion alarm causes this cpu usage spike? If so, is it safe to delete it?

You can disable motion sensor in configuration of device in ha. All changes were under the hood in Home Assistant.

I just disabled the motion alarm but the cpu usage remains the same at 14%.

Am I right in thinking that there is no binary sensor for baby cry detection yet?

Is there a way to receive this via webhooks?

No binary sensor yet for baby cry, and no unfortunately no it is not exposed via Onvif. If tplink chooses to expose this in the future it will automatically appear.

Hi, may I know how to determine if the camera uses pullpoint or webhook?

Hi, you can enable debug logs for both this integration and homeassistant.onvif. You will then be able to see it in the logs including the webhooks URL, if it is enabled.

1 Like

Hi
I’ve had 2 TC60s running with the Tapo: Cameras Control for a couple of years. I got the 3 entities (SD, HD, Motion) per camera fine, and had automations on motion too.
But for several weeks now all my entities have been Unavailable with an exclamation mark. Periodically it report Initializing but fails with a message Retrying Setup: None.
I’ve scanned the thread above but can only see posts relating to motion detection. I cannot see the videos that I used to be able to.
Also, I’ve just bought a new Tapo C110 and configured it on my LAN fine but have no idea how to add it to the Cameras Control.
All 3 cameras are working fine in the Tapo app.

Hi, follow instructions on how to add the camera from readme.
For unavailable cameras, see/post error from logs.

Thanks. I reinstalled, like the readme says to get it to find the new camera, and it did.
So now I’ve got 3 cameras that don’t work with the add-on.
Restarted HA then did a search for tapo in the logs and just got these 2 entries:-

Home Assistant Core
Unable to connect to Tapo: Cameras Control controller: ONVIFCamera.create_pullpoint_subscription() takes 1 positional argument but 2 were given
15:14:03 – (ERROR) Tapo: Cameras Control (custom integration) - message first occurred at 15:07:35 and shows up 24 times
Config entry '192.168.0.92' for tapo_control integration not ready yet: None; Retrying in background
15:07:35 – (WARNING) config_entries.py - message first occurred at 15:07:35 and shows up 3 times

Update to the latest version of HA and integration.

Thanks for your help.
I’ve updated HA and all the add-ons but I don’t know how to update the tapo integration. I can’t even find what version of it I’m running!
None of the tapo cameras are working yet. The error in the logs is now just:-

Source: setup.py:214
First occurred: 20:59:23 (1 occurrences)
Last logged: 20:59:23

Setup failed for custom integration tapo_control: Unable to import component: cannot import name 'NotificationManager' from 'onvif.client' (/usr/local/lib/python3.10/site-packages/onvif/client.py)

Follow installation steps in readme.

Thanks for your patience. So I just overwrote the directory with the newer version and it’s all working now. Looks like I just need to sort out the different motion entity.
Loving the Siren switch!

First of all, I wanted to thank you for the excellent work you do to make our cameras work with Home Assistant.

I have a C200 with the following configuration:

type: picture-glance
title: Salon
camera_image: camera.camara_nala_hd_stream
camera_view: live
entities:
  - entity: button.camara_nala_move_left
    icon: mdi:arrow-left-drop-circle-outline
  - entity: button.camara_nala_move_right
    icon: mdi:arrow-right-drop-circle-outline
  - entity: button.camara_nala_move_up
    icon: mdi:arrow-up-drop-circle-outline
  - entity: button.camara_nala_move_down
    icon: mdi:arrow-down-drop-circle-outline
  - entity: switch.camara_nala_privacy
    icon: mdi:eye-off-outline
  - entity: button.camara_nala_reboot
    icon: mdi:power
hold_action:
  action: more-info

The problem with this is that when I press any of the buttons, the entity window appears, so to perform the movement, I have to press “press” again. Is there any way to directly perform the camera movement in any direction without this window appearing? I apologize if my question is stupid, my programming level is -2. Thank you for your understanding.

Thank you, my friend. I had previously tried these examples, but they didn’t work because I didn’t have stack-in-card installed. I couldn’t find it through HACS, and that’s because I wasn’t looking in the right place. Now I have installed it, and everything works perfectly for me. I really appreciate your time in answering me.

Here is my glance card config for the Tapo camera control.

camera_view: live
type: picture-glance
title: Lounge
image: https://demo.home-assistant.io/stub_config/kitchen.png
camera_image: camera.tapo_sd_stream
entities:
  - entity: camera.tapo_sd_stream
    icon: mdi:arrow-left-drop-circle-outline
    tap_action:
      action: call-service
      service: button.press
      service_data:
        entity_id: button.tapo_move_left
  - entity: camera.tapo_sd_stream
    icon: mdi:arrow-up-drop-circle-outline
    tap_action:
      action: call-service
      service: button.press
      service_data:
        entity_id: button.tapo_move_up
  - entity: camera.tapo_sd_stream
    icon: mdi:arrow-down-drop-circle-outline
    tap_action:
      action: call-service
      service: button.press
      service_data:
        entity_id: button.tapo_move_down
  - entity: camera.tapo_sd_stream
    icon: mdi:arrow-right-drop-circle-outline
    tap_action:
      action: call-service
      service: button.press
      service_data:
        entity_id: button.tapo_move_right
  - entity: camera.tapo_sd_stream
    icon: mdi:eye-outline
    tap_action:
      action: call-service
      service: switch.turn_off
      service_data:
        entity_id: switch.tapo_privacy
  - entity: camera.tapo_sd_stream
    icon: mdi:eye-off-outline
    tap_action:
      action: call-service
      service: switch.turn_on
      service_data:
        entity_id: switch.tapo_privacy
  - entity: camera.tapo_sd_stream
    icon: mdi:power
    tap_action:
      action: call-service
      service: button.press
      service_data:
        entity_id: button.tapo_reboot
hold_action:
  action: more-info

Hope it helps you.

Thank you very much, this is what I have been trying to do from the beginning. It has made my day. :smiley: