-
Notifications
You must be signed in to change notification settings - Fork 87
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 😊 |
I was looking into this again in hope to implement it and tested it on C200 HW 1.0 1.3.6 Build 230424 Rel.77225n(4555) and C200 HW 3.0 1.3.6 Build 230424 Rel.77225n(4555) with this script and I am only getting the event once it stops - not when it starts. Meaning it shows up with endRelative 0 but never with missing end or start being around 0. Is this different for you @AndreiArdelean1 ? |
|
@JurajNyiri I ran the script and noticed that it only returns the event about 2s AFTER the detection window ends. I tested it on my TAPO C200. I'm going to test on the C310 in a little while I'll return here.
|
My C310 answer:
I'm doing some research to try to figure out how (if) can we change this behavior... |
Also very interested in this feature - I have C210 cameras and always happy to help test |
For those looking to use the built-in Tapo person detection with Home Assistant, until we can do so through this integration, I am using a workaround: I have a Tapo TC65 and a Tapo smart socket P100. In the Tapo app, I can set the smart socket to switch on based on AI person detection. Obviously not an ideal workaround, but it works well enough for me for now! |
That's interesting, I am currently using the person detection routine in Alexa to turn a Phillips hue light on that gets detected by HA. The most cumbersome way of detecting a person i suppose but didn't find a better way. Your method would allow me a least to ditch Alexa who tries to sell me batteries for my hue remotes when they run out... |
@Myrddraal can you check if your solution works without internet? I know the camera's person detection is done off line but I wonder if the internet is necessary for your tapo automation to work |
@NEVdataDyne I haven't tried, but I'm fairly sure that it does rely on an internet connection. As I understand it, you can view the camera feed on the same network, without internet, but controlling other devices requires an internet connection. |
Does it seem unlikely that we will ever be able to get Person Detection events? This is the main issue preventing me from going all local. |
The best would be to ask tplink to add it to the onvif standard. Then it will work across all the 3rd party solutions and applications. |
TP-Link support said they passed on the request to R&D but you know how that goes... |
Just a small side note based on my observations: I have a Tapo C220 cam. The cam supports two types of notification subscriptions:
I noticed, in accordance with all the above observations, that the cam does not publish events on any topic apart from However, when the second method is used, the cam sends additional events. I can get notifications when AI detects a person in motion ( I haven't tested for other event types yet (pets, cars, noise) as this is a bit harder to do, but I will update this comment if I observe any other event types on the listener. EDITED 2024-02-15: The cam unfortunately does not publish pet-related events to web hook - i.e. cam detects a cat and shows overlay in the app but does not publish |
I just got this custom integration set up for a C120 and am I trying to digest the current state of this issue. 1st question, I think the C120 is fairly new hardware introduced in 2023 based on reviews. Is there any testing I should be doing against it? EDIT Two more questions:
|
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: