-
Notifications
You must be signed in to change notification settings - Fork 92
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 😊 |
Sent out the pull request for person and vehicle detection, which will work for my C325WB. My C720 cameras don't even get motion. I turned on debug logging for onvif component and I see this message:
which looks to be coming from here: I'm not sure why the camera would be returning a 500 error when trying to set up onvif pull subscription. I turned on "Diagnostics" on the camera that supposedly outputs a log file to the sd card. Going to pull it and see if there's anything helpful on it. |
Nothing interesting in the camera's diagnostic log, so not sure what else to try for debugging why some cameras just return 500s when trying to pull notifications. For anyone else not getting events, it would be nice to confirm people see the same issue with other cameras, since I only have my C720s that are showing this symptom. If you enable debug logging like this in your configuration.yaml file:
You should see a log message like mine. |
I have a TC55 - which is identical to the C720 as far as I can tell - and it also doesn't seem to send any ONVIF notifications. There is a I enabled
I wonder if the C720/TC55 firmware doesn't have proper support for ONVIF events? That would be a big bummer. EDIT: I just tested, and Scrypted can receive basic motion events from the TC55 via ONVIF. So I'm not sure why it's not working in HA. |
For my C720s, I turned off webhook in the device configuration and restarted home assistant. Switching to pullpoint seemed to make motion events start coming in, but they seem unreliable. And only motion gets picked up, no other events. The C325WB is working great with webhook and that's where I see the other event types. I wonder if pullpoint somehow doesn't work with other event types and for some reason webhooks are broken on C720/TC55. I'll play around some more with seeing if I can get webhooks working with my C720 cameras. |
confirmed: Camera1-C210: Starting PullPoint manager (...)) |
Some exciting progress. I installed this onvif client software to test an independent implementation: And after subscribing to events on my C720, I am able to see both motion and people events coming in: So that tells me that the C720 at least is capable of producing these events. Next I'm going to try to capture the xml payloads with wireshark to hopefully figure out the difference between what this happytime client is doing vs. home assistant's python onvif/zeep client. |
I figured out what causes the 500 internal server error. The cameras do not like the This fails:
While this works:
To get that to be output, I added:
to |
Status:
Nothing else I can do until those are accepted. |
Good news, everything has been merged. Unfortunately, it looks like I just barely missed the 2024.12.0 release for the person and vehicle event change. However, the bump to onvif-zeep-async to 3.1.13 did make it into 2024.12.0, so some cameras should start getting motion events using push that were broken with pull. We'll have to wait for the next release to pick up the person and vehicle event. |
Hey guys, think I may have misunderstood? I don't see any new entities for my camera. I have cw320. I'm on 2024.12.2. |
I see some discussion here that maybe the cw320 events don't work? Do you have motion notifications enabled on the camera? Do you get notified on the app when it detects motion? If so, you should see the motion detection show up as a sensor on the device page, e.g. |
@jterrace i get the motion events :) just not person/vehicle. I'll have a look at the thread you posted |
No, that's the expected behavior right now. The person/vehicle events change didn't make it into 2024.12, we have to wait for 2025.01 |
Aaah that would explain it!! I thought it was in the dot release |
The minor dot fixes only take bug fixes / security fixes. They don't pull in new features :( |
Even through it wasn't pulled it should we be able to see it in logs or how should we understand it. I have motion sensor visible and active but the logs only display :
|
Do you have "Enable webhooks" enabled in the device configuration? |
@simon-bd I see the same as you, but I also have this additional message
I'm guessing it's because I've disabled internet access to my camera from my router. I'm waiting to see what tomorrow's Tapo-app update will do to the camera. I don't want to send my feed to the Internet, but I also would like to receive firmware updates to my camera. So, if I enable Internet access temporarily, I don't want my camera to stop working with this integration. I hope that the new ONVIF code allows us to get all the sensors' data locally, I was relaying on IFTTT to get those specific notifications. I didn't like having my data sent to the Internet, and with the new firmware stopping us from using this integration, it was better to disable Internet access. |
I have internet blocked for the devices as well. I have the c100 and c110. Which devices do you have. I don't see a webhook option in my camera settings |
You probably need to restart home assistant for it to take effect. I could be wrong, but I don't think the cameras need internet access for local onvif to work. |
Thanks a bunch! I already had the ‘Enable webhooks’ option turned on in my Tapo integration settings in Home Assistant. I just set up a second camera of the same model, and I’ll keep an eye on the logs. Before, the second camera was only connected to Scrypted, not to Home Assistant. I’ll keep the internet access blocked for these cameras, even though it’s blocked. I don’t want to send any data to the internet. Thanks again for the helpful instructions and suggestions. I really appreciate you taking the time to walk me through this. |
I have a TC55 (same as C720) and have noticed that if there is more than one ONVIF client connected to it (this integration + Scrypted, for example) event notifications behave erratically - often times motion is "detected" for hours at a time without a break, and sometimes there's no detection at all. I've reported it to TP Link support and they are trying to reproduce it. |
@simon-bd I have two C120, one if v1 and the other v1.6, they're not connected to anything else just this integration and the Tapo app on my phone, and webhook is also enabled. Not sure what the |
Actually, when I enable it looks like I'm still seeing my cameras fall back to pullpoint due to webhook still seeing 500s:
Those errors should have gone away with the bump of
And browsing the 2024.12.2 tag, I also don't see it: Sorry I was mistaken about that: we're going to have to wait for 2025.1 to get any of the changes. |
@jterrace, I would think, that is just an oversight. As it is a version bump and other issue has been resolved and merged to dev as well. Let's try to ping @bdraco and see if home-assistant/core#132229 can be merged. |
@GSzabados there's not much value to the version bump without also getting the person/vehicle detection change, which is clearly a new feature. I don't think merging new features is allowed in point releases. We will just have to be patient and wait for 2025.1 |
@jterrace beta is out with the new updates 🎉🎉 |
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: