I’ve been thinking about how best to process a stream of mqtt updates (in this case coming from Frigate).
My naive (and currently good enough) first attempt was to trigger on an mqtt event, filter on its json contents and then take the appropriate action (in this case, send a telegram notification). I’ve now realised that the single mode of this automation means some immediate updates could be missed, so I’ve since switched that to parallel.
A new feature I’d like to implement is to update previously sent messages. To do this I also need to listen on a “sent telegram” event to get a handle on the sent message. However I’m stuck with the same issue in that there could be lots of these events sent but I can’t figure out a way to listen to all of them within an automation wait for trigger, and if I split these into two automations then there’s no way to share this handle.
Basically I’m looking for a way to process triggers in parallel within an automation. Is this possible?
Why do you need to handle all messages at once? If telegram supports features like normal notify then you should just use the Frigate event ID as the key to update upon. This is how the Frigate blueprint works without any issues.
If I’m understanding what you’re asking for - it doesn’t seem to support those features. There doesn’t seem to be a way to set any kind of key.
The workflow is this:
Send a telegram message, setting the message_tag property (eg to the frigate id).
Listen for a TELEGRAM_SENT event, filter on message_tag and extract a telegram generated message id[1] - the id is simply just the message count from the group you sent to.
Use the message id to update an existing message.
As far as I can tell, neither the telegram bot send service, nor the telegram notify service, return the created message id themselves. Further, message_tag seems to be a property created by the HA telegram integration and isn’t passed to the underlying library - maybe this is how return values used to be dealt with?