0x2142 / frigate-notify

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

[SOLVED] Duplicated notifications of the same event #171

Closed woody4165 closed 3 weeks ago

woody4165 commented 3 weeks ago

Some times, most of the times, I get two telegram message for same event, one without the event clips link and one with. The sent snapshots are almost the same, maybe some frame later the second message. Is it possible to avoid the message without the clip?

Screenshot_20241105-131641

Thanks

freefd commented 3 weeks ago

@woody4165, there is implemented nosnap && noclip business logic https://github.com/0x2142/frigate-notify/blob/main/events/filters.go#L27-L31 The nosnap option is exposed to the configuration and you can control this: https://frigate-notify.0x2142.com/latest/config/file/#general It looks like you have an opposite case, where the snapshot has already been taken but the clip is still in the process of recording.

@woody4165 what do you have in your Frigate-notify logs for the shown events?

woody4165 commented 3 weeks ago

Thanks @freefd

I see the nosnap option in the config file, but I don't see in the docs the noclip.

This is a log related to an event (not the one in the previous picture) where I get one message without clip link and a second one with the link

2024/11/05 13:24:32 +0100 INF events/mqtt.go:76 > New event received event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 INF events/mqtt.go:90 > Event Detected camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=
2024/11/05 13:24:32 +0100 DBG events/mqtt.go:93 > Event start time: 2024-11-05 13:24:31 +0100 CET event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 INF events/filters.go:30 > Event dropped - No snapshot or clip available event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 INF events/mqtt.go:80 > Event update received event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 INF events/mqtt.go:90 > Event Detected camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=
2024/11/05 13:24:32 +0100 DBG events/mqtt.go:93 > Event start time: 2024-11-05 13:24:31 +0100 CET event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 DBG events/cache.go:82 > Event not in cache, adding... camera=vialetto event_id=1730809471.544451-cqptxf zones=
2024/11/05 13:24:32 +0100 DBG events/mqtt.go:115 > Object entered new zone camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=
2024/11/05 13:24:32 +0100 DBG notifier/webhook.go:33 > Custom message template used event_id=1730809471.544451-cqptxf provider=Webhook rendered_template="{\"camera\":\"vialetto\",\"id\":\"1730809471.544451-cqptxf\",\"label\":\"person\"}"
2024/11/05 13:24:32 +0100 DBG notifier/telegram.go:24 > Custom message template used event_id=1730809471.544451-cqptxf provider=Telegram rendered_template="Motion alle 13:24:31 del 05/11/2024\nCamera: vialetto\nLabel: person (76%)\n\n\n\n\n\n"
2024/11/05 13:24:32 +0100 INF events/mqtt.go:80 > Event update received event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 INF events/mqtt.go:90 > Event Detected camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=viale
2024/11/05 13:24:32 +0100 DBG events/mqtt.go:93 > Event start time: 2024-11-05 13:24:31 +0100 CET event_id=1730809471.544451-cqptxf
2024/11/05 13:24:32 +0100 DBG events/cache.go:93 > Found new zone not in cache camera=vialetto event_id=1730809471.544451-cqptxf zones=viale
2024/11/05 13:24:32 +0100 DBG events/mqtt.go:115 > Object entered new zone camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=viale
2024/11/05 13:24:32 +0100 DBG notifier/webhook.go:33 > Custom message template used event_id=1730809471.544451-cqptxf provider=Webhook rendered_template="{\"camera\":\"vialetto\",\"id\":\"1730809471.544451-cqptxf\",\"label\":\"person\"}"
2024/11/05 13:24:32 +0100 DBG notifier/telegram.go:24 > Custom message template used event_id=1730809471.544451-cqptxf provider=Telegram rendered_template="Motion alle 13:24:31 del 05/11/2024\nCamera: vialetto\nLabel: person (77%)\n\n - Event Clip: http://192.168.1.43:5000/api/events/1730809471.544451-cqptxf/clip.mp4\n\n\n\n"
2024/11/05 13:24:32 +0100 INF notifier/telegram.go:77 > Alert sent event_id=1730809471.544451-cqptxf provider=Telegram
2024/11/05 13:24:32 +0100 INF notifier/telegram.go:77 > Alert sent event_id=1730809471.544451-cqptxf provider=Telegram
2024/11/05 13:24:33 +0100 INF notifier/webhook.go:59 > Alert sent event_id=1730809471.544451-cqptxf provider=Webhook
2024/11/05 13:24:33 +0100 INF notifier/webhook.go:59 > Alert sent event_id=1730809471.544451-cqptxf provider=Webhook
2024/11/05 13:24:42 +0100 DBG events/mqtt.go:134 > Event ended event_id=1730809471.544451-cqptxf
2024/11/05 13:24:42 +0100 DBG events/cache.go:114 > Event removed from cache camera=vialetto event_id=1730809471.544451-cqptxf zones=viale
freefd commented 3 weeks ago

@woody4165,

I see the nosnap option in the config file, but I don't see in the docs the noclip.

Because the noclip option in not yet available in the configuration :)

As we can see you have configured zone and related events.

unzoned:

2024/11/05 13:24:32 +0100 DBG events/mqtt.go:115 > Object entered new zone camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=

zoned:

2024/11/05 13:24:32 +0100 DBG events/mqtt.go:115 > Object entered new zone camera=vialetto event_id=1730809471.544451-cqptxf label=person zones=viale

For the duplicated events, I guess, you hit the known issue #66.

But why the has_clip: true parameter is not set in the first event - that is the question. I would suggest to set trace log level instead of debug and find raw (https://github.com/0x2142/frigate-notify/blob/main/events/mqtt.go#L68-L70) event objects from MQTT broker.

woody4165 commented 3 weeks ago

@freefd now I've set unzoned to drop and I don't get anymore the message without the clip link

That message was, strangely, without a zone even if the zone for that camera is almost the whole area and I'm sure that the motion is detected within the zone defined

Thanks

Let me know if I can close as solved this issue

freefd commented 3 weeks ago

I've set unzoned to drop and I don't get anymore the message without the clip link

@woody4165, definitely, you've solved the initial root cause with unwanted behavior of the unzoned notification. But the second part with the question “why unzoned events don't have has_clip: true” remains unanswered.

Nevertheless, I'd suggest to:

And analyze and try to solve the second part next time by a request from someone else :)

woody4165 commented 3 weeks ago

thanks @freefd

I really don't know how to answer to second question!!!