0x2142 / frigate-notify

Event notifications for a standalone Frigate NVR instance
https://frigate-notify.0x2142.com/
MIT License
102 stars 9 forks source link

Sequence: new event without snapshot, update in same zone does not trigger notification #121

Closed lubomir-moric closed 3 weeks ago

lubomir-moric commented 2 months ago

Describe the bug When object enters allowed zone, Frigate might not yet have snapshot or clip, so notification is not generated: Event dropped - No snapshot or clip available Later update event is received, already with snapshot or clip, but it is inside same zone: Event dropped - Already notified on this zone

Expected behavior When snapshot or clip is available, even event comes from same zone, it should be notified. Problematic condition in code: here.

To Reproduce Steps to reproduce the behavior:

Versions:

Frigate-Notify Logs:

2024/08/15 17:00:55 +0200 INF New event received event_id=1723734055.172552-sw1glv
2024/08/15 17:00:55 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=
2024/08/15 17:00:55 +0200 INF Event dropped - Outside of zone. event_id=1723734055.172552-sw1glv zones=
2024/08/15 17:00:56 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:00:56 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=zahrada
2024/08/15 17:00:56 +0200 INF Event dropped - No snapshot or clip available event_id=1723734055.172552-sw1glv
2024/08/15 17:00:56 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:00:56 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=zahrada
2024/08/15 17:00:56 +0200 INF Event dropped - Already notified on this zone camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=zahrada
2024/08/15 17:01:02 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:02 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=zahrada
2024/08/15 17:01:02 +0200 INF Event dropped - Already notified on this zone camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=zahrada
2024/08/15 17:01:03 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:03 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=
2024/08/15 17:01:03 +0200 INF Event dropped - Outside of zone. event_id=1723734055.172552-sw1glv zones=
2024/08/15 17:01:03 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:03 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=terasa
2024/08/15 17:01:03 +0200 INF Event dropped - Not on zone allow list. event_id=1723734055.172552-sw1glv zones=terasa
2024/08/15 17:01:08 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:08 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=terasa
2024/08/15 17:01:08 +0200 INF Event dropped - Not on zone allow list. event_id=1723734055.172552-sw1glv zones=terasa
2024/08/15 17:01:14 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:14 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=terasa
2024/08/15 17:01:14 +0200 INF Event dropped - Not on zone allow list. event_id=1723734055.172552-sw1glv zones=terasa
2024/08/15 17:01:20 +0200 INF Event update received event_id=1723734055.172552-sw1glv
2024/08/15 17:01:20 +0200 INF Event Detected camera=Zahrada event_id=1723734055.172552-sw1glv label=person zones=terasa
2024/08/15 17:01:20 +0200 INF Event dropped - Not on zone allow list. event_id=1723734055.172552-sw1glv zones=terasa

^^^ where Zahrada is allowed zone, Terasa is not listed in allowed zones.

Additional context Seems it will be necessary to have some in-memory map of event IDs and booleans flagging that notification was already sent?

0x2142 commented 2 months ago

Ahh, Interesting & Thanks for finding and reporting this! I haven't run into this yet, but it makes sense why it's happening.

I have been hoping to avoid persisting any data between event messages for as long as I can, but it seems this might finally push me to do it 😅

I'll add this to my list & start thinking about how to best resolve this 👍

0x2142 commented 1 month ago

Hello, hello! Just a quick note that I have a fix for this in the dev branch if you would like to test or try it early. If you do, please let me know how it goes!

0x2142 commented 3 weeks ago

Fix is now released in v0.3.5