I want to create an automation that triggers on a topic. However I have to look into the message payload that is delivered and check two pieces of data for my trigger to fire however I can’t see how to do this:
This works but I also need to check: {{ trigger.payload_json["type"] == "end" }}
I know I could do this with a condition but the automation I want to write has a separate second trigger that is based on a binary sensor which wouldn’t pass the condition (and I want it to).
For those that use Frigate NVR what I’m trying to do is a single automation to send a telegram message with a camera.snapshot as soon as motion is detected (which uses Frigate’s binary sensor) and then when the event has stopped I’d like to send a second telegram message with the video.
I can do this as two automations but that adds clutter that I’d prefer not to have and above doesn’t sound like it should be hard.
@koying Thanks for your post
You helped me solve a problem I’ve been trying to get my head around for the last couple of days: “How to trigger when a json object is present in the trigger payload”
My mqtt message only has the object action in the payload when the button is pressed, but my trigger kept firing every hour. I finally realised that the battery value is reported hourly, but the payload does not contain the action object, so my light was toggling on & off even though I had not pressed the button.