-
Notifications
You must be signed in to change notification settings - Fork 11
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
Incomplete notifications in Telegram #54
Comments
Hello there & Thanks for using this project! So, I don't use Telegram as my primary notification method - but I did enable it to see if I can re-create your problem. So far I am seeing the correct percentage each time, but I'll keep it active for a while & see what happens. Could you take a look at what the Frigate API shows for one of the events the displays 0%? If you grab the event ID, you can browse to the following: For the second issue - Are you using a VPN to connect back to that remote location? Or have the Frigate web UI available over the public internet? The links generated will point directly to the Frigate server, so the links would only work if you're able to connect to Frigate remotely. |
Hi @mike2307, additionally please provide the frigate-notify configuration (do not forget to obscure sensitive things like credentials, etc). |
Comparing the provided event example and app code (https://github.com/0x2142/frigate-notify/blob/main/events/events.go#L31), the
Meanwhile, I have the same trouble with non-clickable links on one of several frigate-notify installations, but I use the MQTT bus everywhere, so we can conclude the WebAPI approach you are using is not the root cause. @0x2142, I'm also voting for this part :) |
I don't have any zones configured in my frigate instance. |
Thank you both for the additional info! I appreciate the help! So while I was looking at this a moment ago, I noticed that my instance doesn't report a @freefd - Just to double check, are you also on the latest 0.13.2 release? On the Telegram side, I am not sure just yet - I've left mine enabled but haven't seen this happen. But I'll focus on getting my Frigate instance upgraded first, and keep Telegram enabled. We'll figure it out - just might need some time 😊 |
My Frigate instances are |
Hey there - Just released v0.2.8, which should fix the 0% label issue. In addition, I spent a bunch of time re-working the notifications & I'm hoping this may also fix the Telegram link issue. Please let me know if you're still seeing that after upgrading. Thanks! |
@0x2142 Logs:
Did anything change regarding the connection handling? |
Found the culprit: In my setup with podman compose, both the frigate and frigate-notify container are started together. The best way to tackle this would be a dependency to a healthy frigate container, which could look like this:
Unfortunately podman compose doesn't support that yet: containers/podman-compose#866 So for now I can think of the following options:
|
Ahh, okay. Yeah, adding a health check at startup had been on my list a while - because until now, it wouldn't ever try (and possibly fail) to reach Frigate until an event was detected. So after seeing your issue earlier with the URL syntax, it reminded me that I should include that & notify quickly if the Frigate API isn't reachable. That being said - I appreciate your feedback since your deployment is a bit different than mine & I only test against my own set up at the moment. And currently I run these two under separate compose files so that I don't have to restart Frigate often. In theory, I think as long as this app is set to I think I'll work up a quick retry / timeout for that startup check, but I imagine it would only make sense to wait up to 30-60 seconds before throwing an error & exiting. I'll have to think about whether it makes sense to have that max wait interval a configurable option, or perhaps an option to disable that startup check entirely. Let me know if you have any thoughts or a preference on that - I'm always open to other opinions & feedback! |
Yes, a retry mechanism with an interval of a few seconds and a timeout of something in the range of 30-60 seconds should be fine. Even better if this would be configurable. I have no idea how long the startup of frigate could take on a system with a lot of cameras (if this even has an influence on the availability of the HTTP API readiness).
EDIT: |
I can confirm that the issue with the missing percentage values has been fixed with the latest version. |
Just a quick note to say I haven't forgotten about the Telegram link issue. However, I've also been running with Telegram enabled on my side & still haven't had this happen to me yet 🤔 In the new release, I've added support for custom notification templates - which may be one way for you to address this. Along with that, I added some debug logging that will print the rendered notification template to the log if a custom template is used. Can I have one of you try using the template below & enable debug logging? It's a copy of what I'm using as the standard template. Then if the links stop working again, please send me a copy of the logs with the rendered message & hopefully that will help point to the issue. alerts:
telegram:
enabled: true
chatid: xxxxxxxxx
token: xxxxxxxxx
template: |
Detection at {{ .Extra.FormattedTime }}
Camera: {{ .Camera }}
Label: {{ .Label }} ({{ .Extra.TopScorePercent }})
{{ if ge (len .Zones ) 1 }}Zone(s): {{ .Extra.ZoneList }}
{{ end }}
{{ if ne .Extra.PublicURL "" }}Links: <a href="{{ .Extra.PublicURL }}/cameras/{{ .Camera }}">Camera</a> {{ if .HasClip }} | <a href="{{ .Extra.PublicURL }}/api/events/{{ .ID }}/clip.mp4">Event Clip</a> {{ end }}
{{ else }}Links: <a href="{{ .Extra.LocalURL }}/cameras/{{ .Camera }}">Camera</a>{{ if .HasClip }} | <a href="{{ .Extra.LocalURL }}/api/events/{{ .ID }}/clip.mp4">Event Clip</a> {{ end }}
{{ end }} |
Thanks! 👍 I updated to the latest image, enabled debug logging and added the above provided template to my yml file. It's a bit of a remote location and I'm there on the weekend again. |
Dear @mike2307, you wrote:
I also updated to the latest v0.3.0 and did several tests. My findings:
In the result message links are rendered as text:
In the result message links are rendered as html: I've run raw tests with the Telegram bot and can confirm that this behavior comes from Telegram itself: ~> curl -sq -d parse_mode=HTML -d chat_id=<telegram_chatid> -X POST https://api.telegram.org/bot<telegram_botid>/sendMessage -d text='<a href="https://domain.tld/">Test link without username and password</a>' | jq .ok
true
~> curl -sq -d parse_mode=HTML -d chat_id=<telegram_chatid> -X POST https://api.telegram.org/bot<telegram_botid>/sendMessage -d text='<a href="https://username:[email protected]/">Test link with username and password</a>' | jq .ok
true Unfortunately, using @0x2142, I haven't yet found any public information about this in the official Telegram documentation or related bot settings. |
Exactly the same on my side
In my case the solution should simply be to provide correct public_url in an IP format, which should be fine in my case as everything is in my VPN anyway and the addresses don't change. I'll keep you updated. |
Ahhh, that's interesting to know! Thanks for digging in! I can add a note to the docs to mention this 👍 |
I can confirm that settings a |
I think I'm going to go ahead and close this for now, since it seems like a Telegram-side thing. I did make a note in the latest docs to mention this in case anyone else has the same issue. |
First of all:
Thank you for this awesome frigate extension!
This was the only part of frigate that I was missing really badly.
This reddit post lead me here and I'm very glad about it.
I only noticed a few issues with the generated Telegram notifications:
I'm using version v2.7.0 of this software and 0.13.2 of frigate.
The text was updated successfully, but these errors were encountered: