[Custom Component] Tapo: Cameras Control

Great update for motion sensor fix. What is the difference ietween the Cell Motion Detection & the Motion Alarm binary sensors?

While the Tapo applicaiton is now supporting a specific person detection versus motion detection, is it planned to get also at some point a binary sensor for person detection only in HA?

2 Likes

Your guess is as good as mine. :slight_smile: It is whatever camera exposes.

Camera does not expose it via Onvif but we do have an issue open tracking work on an alternative way to get events (including person detection) but it’s not ready yet.

1 Like

Sorry for my ignorance on this but can you explain a bit more? I updated the repository, removed my existing cam in HA and added it again. Still not seeing a motion sensor among the entities of the device. My HA is exposed using cloudflare and https, not sure if this is doing something there. The local way of reaching homeassistant still works without https tho. Not sure if I’m doing something wrong. I don’t know if I need to activate something or what. Thanks in advance

Update: I’m seeing this error on logs now
Logger: homeassistant.config_entries
Source: helpers/entity_component.py:179
First occurred: 18:18:20 (1 occurrences)
Last logged: 18:18:20

Error setting up entry 192.168.0.165 for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 131, in async_setup_entry
return await component.async_setup_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 179, in async_setup_entry
raise ValueError(“Config entry has already been setup!”)
ValueError: Config entry has already been setup!

Hey, @JurajNyiri.

Sorry to go back a while; things started working again. But I had to put frigate aside.

Now, I’m trying what you said about using the restream for this integration.
So, sorry for the mix, but can you give some tips on how your doing it?

For instance, in frigate.yaml, I’m using:

go2rtc:
  streams:
    outsidefront:
      - rtsp://outsidefront:[email protected]:554/stream1
cameras:    
  outsidefront:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/outsidefront #hd 1920x1080 - stream1
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5

How should I go about adding the restream to this integration?

edit:

Hmmm… even if I try to add only the sub stream, to the integration, I’m getting: “Failed to establish a new connection”. Using the ip from the camera itself will it not create another connection?
I was able to add the sub stream (stream2) to Synology’s Surveillance Station.

Hi all, I’m a newbie and I’m starting to play with HA and this great Tapo integration. I have two C210 cameras. I’m running HA 2023.5.2 and Tapo Cameras Control 5.2.2.
The first time I have configured cameras in HA, everything seemed to work fine and I was able to see motion binary sensor change their value when movement was detected. Now, after a few days and a few camera’s reboot, camera interaction seem still ok (I can set/unset privacy mode, move it to preset) but binary_sensor.tapo_1_cell_motion_detection always remains “unavailable” even when movement is detected (and when Tapo app notifies it to me).
I don’t understand why sensor’s value is no more updated. Can you help me pointing to a log or something I can read to understand what’s happening?

Ps. camera’s IP is still the same

I experience similar issues with my C110 as the motion sensor does not reappear anymore since the recent update(s). But I found a kind of a workaround with that cell motion detection sensor entity:

binary_sensor.mycamera_cell_motion_detection.

I am not really sure what exactly this sensor is good for and how it can be configured. My guess is: Once configured, the sensor will be able to report motions in specific portions (cells) of the image.

On trial I changed all references in my code from binary_sensor.mycamera_motion to binary_sensor.mycamera_cell_motion_detection and it seems to do the trick as it reports motions (although not configured in any way). I cannot judge whether the behavior is exactly the same like before but for me it works so far.

According to

just change all references in your code from former binary_sensor.mycamera_motion to binary_sensor.mycamera_cell_motion_detection (or rename the entity) and you’re done.

1 Like

As stated in release notes of 5.2.0 breaking changes.

I was aware of this and did follow all your instructions from the FAQ. Nevertheless, the motion sensor did not show up again so I looked for a different solution. I hope the workaround which I posted here may be useful for other people who have similar issues.

Motion sensors now use name provided by camera. Because of this, your entity id might change. If you see an unavailable sensor after updating, you can safely remove it (do not disable!). Sensor will be recreated on first motion. You can change entity_id back to what you used to have.

binary_sensor.mycamera_cell_motion_detection is the motion sensor.

Thanks for clarification. I was not aware of the changed naming scheme of the motion sensor. Sorry for the trouble.

1 Like

Hi, I installed this great integration. Unfortunately I only have these two services to choose from. What I have done wrong? I have a TAPO C310. Can someone help me?

Were are the Others.

Hi JurajNyiri

First of all, thank you for the custom component for me it works great, thank you so much

Regarding using webhooks for motion sensor, can you please help with some examples of how to use it? I already activated the self-generated webhook (I am using Nabucasa) but not quite sure how to use it

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?