-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Add multiple events detections #304
Comments
This integration reuses onvif from Home Assistant. Adding detectors for these would require to expand on it or handlers to be added into https://github.com/home-assistant/core/blob/dev/homeassistant/components/onvif/parsers.py . |
Please report them here. I tested on C200 with my Person Detection enabled and I have not received any events... |
I would like to help as I need my tapo cameras to trigger automations in HA when a person is detected. Until now the only way I could achieve that is to use Alexa between the cameras and HA. With this solution the cameras need to access internet which is not ideal. Using the video stream to detect people on another system is also not a solution because it uses the WiFi so much that it interferes with my Philips Hue remotes. Could you please tell me how to install https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/expand_onvif ? |
I downloaded the zip I am not sure what I should do? |
The code in the branch above doesnt have any new entities. However, it will catch any previously uncought events with an error message. If you are not seeing any other events then it looks like the camera is not issueing those events. I will do some more testing later with the subscription. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@NEVdataDyne It looks like you are having the issue #303 (the last error in your comment). Is your motion sensor (classic one) working/triggered in Homeassistant? @JurajNyiri I'm not seeing any of the errors you mentioned. Could it be that the integration needs to subscribe explicitly for certain events? Something like "on event PERSON_DETECTED post to WEBHOOK". Also, because of #303 I'm having issues at the moment. I'm changing the file manually inside |
@AndreiArdelean1 No motion sensor doesn't seem to work. It doesn't seem to work even with my C110 camera so I am not really sure if I am doing somethng wrong. (I have C225, C320WS and one C110 camera) |
I've gotten the integration to work by modifying Also, the ONVIF integration declares I'll investigate this further and post updates if I find something else. |
I didn't manage to find a way of getting the special detection events, but the following will help with integrating the configuration of these events (enabling and sensitivity) into HA and pytapo. Here is the request the app makes on start: A few examples of setting detection configs:
|
Updated the code in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/expand_onvif
You should now see:
|
I've already done something similar, but the only thing that changed was the |
I have added to main branch (not yet released to pypi):
I was not able to test: setBarkDetection @AndreiArdelean1 could you please test above? Edit: Released as pytapo 3.1.8. |
@AndreiArdelean1 now released in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.1.0.beta.1 Please test above, my devices do not support it. |
They all work except for |
I've been investigating this issue and here is what I've found so far: ONVIF:
UDP:
API:
What can be used, for event detection is the call:
and returning:
A few things to note here:
I've written this python script to get the events from the last 10 min to test it:
Maybe this method of detection motion could be used to detect motion on #273.
Instead of making a call periodically, the ONVIF motion event could be used to trigger the call to Probably the best solution would be a combination of making a call periodically and watching for ONVIF motion events. Other possible methods not yet discovered/implemented on the camera:
|
Maybe in "Other possible methods not yet discovered/implemented" you can add "intercept the calls made by the camera to Alexa servers for notification" (for people detection). For some reason Alex seems to be the only service other than Tapo to get notified when a person is detected (and this is the only event Alexa can get). |
I've written this script (attached) to pull events from the camera. It works really well. I'd implement a proof of concept for |
Thank you @AndreiArdelean1 . I played with the script, it had a bug where it was calculating incorrect start time for cameras in different timezone to UTC-0. I adjusted a couple of things and released new function I am testing with following script:
I tested on 2 C200s. One HW V1.0 and another one 3.0. The 3.0 also has tapo cloud subscription.
I tested also with your script only to verify I haven't made any mistakes when writing the new function. Could you try it and let me know if it works with your cameras? |
I get something like:
What I've noticed, if multiple sources (script and Tapo app) are requesting the events at once, one of them could return an empty list. |
Off-topic, but I'm not sure where I should post this:
I'm not sure which work, which don't, or what they mean. I've extracted them from the Android app.
|
@AndreiArdelean1 could you please test this script with the pytapo 3.1.13 to verify it still works? I think I managed to fix the timezone issue and it seems to be working fairly well now for me. |
It works! |
When I try to run the script above on the latest python docker image I get the following error: Do you have a tip? Maybe it has something todo with the IP not being a hostname? Is there a way to set the request to insecure? |
@AndreiArdelean1 Just to clarify, you were able to extract the AI detected events (person, pet, vehicle, baby crying, etc.)? I was playing around for a minute with the |
Hey, yes, it is working. It did work for motion, person, and pet, but it wasn't working for tamper detection (Or I didn't manage to get it in my testing as that type of detection was a bit hard to trigger). Sounds detection (meow, bark, baby, glass break) I couldn't trigger the actual event during testing so I can't say if it is working. But, if an event is shown with the correct icon in the playback list in the official app, then you should also be able to detect it with this function. You could:
I've only tested method 1. When investigating I had some issues with ONVIF so I couldn't test method 2. |
Thank you for letting me know! I'm mainly interested in the sounds detection, so might try to get this to work. (In case you're interested, I have had success in triggering the events resulting in notifications through the Tapo app by simply using youtube videos of baby crying, dog barking, etc.) @JurajNyiri Any plans to implement something like this in the Home Assistant integration? I will probably try to do something ad-hoc, but would be really cool to have this in the integration 😊 |
@distante do you see anything in home assistant logs for the C200? What we want to see are messages like "No registered handler for event from". Though I'd be surprised if C200 sends different events than C210. |
@jterrace just the regular HA Core logs? There I see nothing. I enabled Debug logs on the Tapo Control integration and then I download and I also did not found any "No registered handler" log, but I saw something As part of the "raw" log from getCamData the C200 gets this with
while the C210 gets
I have the exact same config on both cameras though (in the app) |
I enabled internet access for some minutes to on one of my C200 cameras and when I am moving around I get Tapo App notification about Person Detection and Motion Detection, so the camera does detects it. Could it be that C200 Hardware version 1 Does not expose them? Is this a TPLink issue? |
@distante, what is your expectation from the C200. You should have Cell Motion Detection and Motion Alarm as entities. Baby crying is not sending onvif event as it was discussed before. The camera does not support anything else. If you do not see those sensors then look at the integrations read me page, and look for the troubleshooting section regarding the Motion Detection sensors and webhooks and pullPoint for ONVIF. |
@GSzabados the camera has local Person Detection (says the app options) but they are not being transfer to HA and (when internet enabled) I get Person notifications from the Native app. Baby crying is not important for me. My expectation was that the C200 also get the Person sensor.
From where does this info comes? Regards |
No, you don't need internet for this. This is a local integration. I think, I get what you mean, that there is no separate Person detected sensor. There was never for these cameras. Only Cell Motion Alarm and Motion Alarm. As the Baby Cry is not sent as an onvif event, I guess it doesn't send the person detection either. So, yes, likely it is a Tapo/TP-Link issue. I am tagging @JurajNyiri, because he has a C200 as I remember, so he can confirm this. @jterrace, if you change any further emails with Tapo, would you mind to include this as well regarding the onvif events for the C200? I believe that is the case with the C100 as well, but need to cross check it. |
I can let TP-Link know that person detection isn't working on the C200 too, but can we get one more person to confirm first? Once we confirm, we should also start a thread on the TP-Link forums like we did for baby crying detection. |
C200 (Hw 1.0), 1.3.16 - Tapo App support for Motion, Person and Baby Crying sound. Onvif only supports Motion (checked with Happytime onvif client) |
For info I have the following cameras available
Let me know if I can help with any testing. |
Thanks for confirming! Does someone want to file a post on the forum like we did for baby crying here? I guess we could re-use the same post, but I think a separate post for C200 person makes more sense. Once someone files that (and we can all upvote it), I'll link it in my email to tp-link. |
Feature request to tapo to enable ONVIF support for Person detection on supported cameras... |
Upvoted and sent an email update to TP-Link |
Thank you so much - this is the feature I've always wanted from this integration! |
Weird, I have one C200 and three C220 and person detection works in all of them I'm guessing my C200 isn't hardware 1.0 (Edit: Ok it says 5.0 in the app) |
Also hardware version 1? |
No, version 5 as I wrote on my Edit |
I have just checked my C110 Cameras and note that H/w v2.0 (Firmware 1.4.3) is supporting Person detection in HA 2025.2, however H/w v1.0 (Firmware 1.3.14) does not. |
I have updated hassio to 2025.2.1 to test person detection in my Tapo cameras with 6.0.10 version of the integration. I have deleted all the cameras from the integration (but no the integration itself), and added all of them, with the same result. Hardware: 2.0 Some clue to investigate why the person detection sensor does not appear? |
@simon-bd is your main instance running on https and dev on http? With webhooks based onvif it does not work with https last I was debugging this. |
@JurajNyiri internal url is http and external is nabu casa on custom url |
@JurajNyiri but seems to be on the right track. The dev install is http only |
@fir3burn @simon-bd enable debug logging for onvif integration (see #304 (comment) above) and make sure that the webhook setup is working. If it's not working, you'll see a message about it failing to be set up with a fallback to pullpoint. You don't want to be using pullpoint. |
Your screenshot there shows it using pullpoint, not webhook. Try restarting home assistant and look at the log on startup. It should try to set up webhook and it must be failing. |
Yep that looks like the correct start, is there more in the log? You should see something like "Switching to PullPoint for events" after some sort of error that caused the webhook to fail. |
Yeah, my url is https too. This is my logs: 2025-02-11 18:27:09.751 DEBUG (MainThread) [homeassistant.components.onvif] Camara Planta Alta: Starting PullPoint manager (Edited to improve format) |
Is your feature request related to a problem? Please describe.
I want to be able to detect multiple event types.
I'm not interested in actually highlighting/retrieving the rectangle where this was detected on the camera, just the detection event.
Describe the solution you'd like
I want to be able to detect and distinguish between:
These notifications are sent to the native app.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
These features are available on 3MP+ cameras for free, and on 1080p cameras using the paid subscription
Here is the response from
GetEventProperties
of the ONVIF endpoint on Tapo C225 camera:Currently, motion detection doesn't work on Tapo C225 #303, but this feature would be nice to have once it is working.
The text was updated successfully, but these errors were encountered: