-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Ability to manually create events through the API #3184
Ability to manually create events through the API #3184
Conversation
Hey Nick, just my two cents as I tried to implememt it in the past but failed. I think for this to work well we need some kind of ExternalTriggerTracker process. It should track the lifecycle of triggers and add events to the event queue. Lifecycles would not be needed for stuff like:
But I think it is needed if one wants to:
I couldnt design such a class with its one tracking queue the last time I tried with the time I had. |
Always open to a different arch for the solution, but I'm curious why and what benefits that would bring. I see what you're saying about advanced control of extended recording behavior, but currently frigate native events don't offer these types of advanced recording behaviors so I personally don't think that is necessary at least for an initial version. I think a large subset of the users requesting this just want a way to key events and save the recording clips for that, and the specific extend recording feature are very edge / advanced use cases. I could certainly be wrong and may be missing some context. Perhaps there's a more advanced iteration of this that could be implemented after. |
Specific recording is already supported by my PR given that there's a separate An arg for a fixed recording length could also be added as optional if users just wanted to simply have a static recording length |
I mean, could very well be me thinking to complicated. Other than transfer the logic in its own module to enable MQTT endpoints I will have to try it out for further feedback. Thanks for taking a stab at it! |
Yeah, still got recordings to get sorted out (I think my Timestamps for start_time are wrong) so then should be in a fully testable state. Also need to figure out if this is something the HASS integration can implement or will be strictly for advanced users. I wasn't sure about MQTT, there aren't any other similar APIs in MQTT yet so I wanted to make sure it should go there too. And thanks for providing feedback! Like I said I think this should hang until release 12 so there is time for fleshing it out more |
Using the frame times definitely keeps the event IDs the same and is working well, but recordings still aren't kept despite |
I don't think this approach will work. I was planning to address this by putting an event in the same event queue used here: https://github.com/blakeblackshear/frigate/blob/master/frigate/object_processing.py#L633 The EventProcessor will pick it up from there and everything else such as recording retention and database writes will be handled just like any other event. |
Okay I see, what I had mostly works except recording which I can see would be very clunky to actually get going. Plus it would ignore the retention and other settings and be more difficult to reconcile with future changes. I'll work on refactoring this PR with that approach and see how it goes 👍 |
9c98815
to
ce13297
Compare
ce13297
to
19e9bc3
Compare
fe0f349
to
750a34f
Compare
750a34f
to
563b98b
Compare
✅ Deploy Preview for frigate-docs canceled.
|
8e17b86
to
a23f412
Compare
Any progress on this PR? I would love to be able to use this |
fbd7180
to
61f6e95
Compare
Co-authored-by: Blake Blackshear <[email protected]>
Co-authored-by: Blake Blackshear <[email protected]>
306cf45
to
48f13a5
Compare
I was just about to open a new feature request for creating new events using the api.. Would it be possible to add a timeoffset so the clip would include X seconds before the api call? |
@sinamics that is not so simple, due to the segment retention in recordings if the user does not have 24/7 recording enabled (or if they do and the mode is not It would be possible to use the existing pre_capture config |
understood. The pre_capture config would be sufficant enough for my usecase. |
feel free to submit a PR if you'd like, otherwise I can at some point this week |
im not that familiar in the backend, so you are welcome to take a look whenever you get time. |
I'm sorry for the blonde question but how/when do I find a documentation or example on how to trigger a recording or event or whatever via API? |
this is only available in 0.13 beta for now, you'll check the docs there |
Been testing this feature and it's working great. although... Would it possible to be able to trigger the manual event via mqtt ? or to at least have the newly created event published on mqtt so a HA can capture the event's information and be used for other purposes such as send a push notification with a clip or snapshot of the manually created event? |
MQTT is not suitable for this type of action
the vast majority of information that is contained in the /events topic on mqtt is not relevant to custom events. and for the other parts, you as the user already know because the user is the one sending this event. |
I have no way of knowing the event's id except after it has been added to frigate and the only way to watch the event is through the frigate-card or by going directly into frigate. it would be very handy to be able to somehow get the event information once in the frigate db so it can be the clip or snapshot can be attached to a push notification vie HA. I've been trying to find a way to get the event's info into HA without success... |
the event id is contained in the response of the create api, which is covered in the documentation
|
I totally missed it... I was able to get to this feature by scattering around the source code... as in the main documentation (I believe for 0.12) is missing... so D'oh moment for me..... |
This creates an api for submitting external events
To-Do: