-
-
Notifications
You must be signed in to change notification settings - Fork 221
Add event listener to smartcam #1388
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
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,12 @@ | |||
"""Module for listen event types.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to keep this inside smartcam for now, as the types are very onvif-specific(?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to have this at the top level so we can add other listen
modules like for trigger logs and motion detection sensors.
@@ -71,6 +71,7 @@ def _legacy_type_to_class(_type: str) -> Any: | |||
"device": None, | |||
"feature": None, | |||
"light": None, | |||
"listen": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a new sub group "camera", which would contain this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above I think we should keep this generic so we can add other listen
modules like for trigger logs and motion detection sensors and have them all exposed with the one cli command. Users can provide the EventType
options if they want to limit the events.
kasa/smartcam/modules/listen.py
Outdated
instance_id: str | ||
|
||
async def _invoke_callback(self, event: EventType) -> None: | ||
self.callback(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug log the event here? I had to go and use wireshark to extract the full SOAP payload to see what's happening :-)
Here's one for the reference:
<?xml version="1.0"?>
<SOAP-ENV:Body>
<wsnt:Notify>
<wsnt:NotificationMessage>
<wsnt:SubscriptionReference>
<wsa5:Address>http://192.168.123.123:2020/event-1_2020</wsa5:Address>
</wsnt:SubscriptionReference>
<wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:VideoSource/MotionAlarm</wsnt:Topic>
<wsnt:ProducerReference>
<wsa5:Address>http://192.168.123.123:5656/event</wsa5:Address>
</wsnt:ProducerReference>
<wsnt:Message>
<tt:Message PropertyOperation="Changed" UtcTime="2024-12-19T12:53:07Z">
<tt:Source>
<tt:SimpleItem Value="raw_vs1" Name="Source"/>
</tt:Source>
<tt:Data>
<tt:SimpleItem Value="false" Name="State"/>
</tt:Data>
</tt:Message>
</wsnt:Message>
</wsnt:NotificationMessage>
</wsnt:Notify>
</SOAP-ENV:Body>
See state = false, i.e., detection probably stopped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now logging all messages although I'm worried this might be a bit too verbose. Maybe this should be a separate verbose flag to function?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1388 +/- ##
==========================================
- Coverage 92.42% 91.60% -0.83%
==========================================
Files 132 135 +3
Lines 8203 8354 +151
Branches 839 847 +8
==========================================
+ Hits 7582 7653 +71
- Misses 459 539 +80
Partials 162 162 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
How did you find those topics? There is also
I just added pet detection configuration in #1465 and I'll try to add the rest soon. Would be great if these events were also included in this PR. I'm open to helping as I have one C220 available for testing. Are you reverse engineering through packet sniffing or are those topics listed somewhere in the spec? I hope this gets merged, tested locally and motion detection works well. Thanks for the effort. |
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
No description provided.