Hello, I am trying to use Node-Red and Frigate together for automations.
I am listening to the friate/events
MQTT topic and I get a payload like the following:
{"before":{"id":"1686592837.186892-9896gb","camera":"frank","frame_time":1686597538.83489,"snapshot_time":1686597538.83489,"label":"person","sub_label":null,"top_score":0.7265625,"false_positive":false,"start_time":1686592837.186892,"end_time":null,"score":0.57421875,"box":[531,531,824,718],"area":54791,"ratio":1.5668449197860963,"region":[508,396,832,720],"stationary":true,"motionless_count":4468,"position_changes":3,"current_zones":[],"entered_zones":[],"has_clip":false,"has_snapshot":true},"after":{"id":"1686592837.186892-9896gb","camera":"frank","frame_time":1686597598.958934,"snapshot_time":1686597538.83489,"label":"person","sub_label":null,"top_score":0.7265625,"false_positive":false,"start_time":1686592837.186892,"end_time":null,"score":0.57421875,"box":[527,537,800,718],"area":49413,"ratio":1.5082872928176796,"region":[493,352,861,720],"stationary":true,"motionless_count":5369,"position_changes":3,"current_zones":[],"entered_zones":[],"has_clip":false,"has_snapshot":true},"type":"update"}
I want to be able to extract and use some of the values like “id”, “label”, or “camera”
For example, I want to send a Discord Notification with a camera snapshot using a function node like this (this then goes into a Discord node):
msg.embed = {
"message": "Check it out",
"image": {
"url": "http://192.168.1.15:8123/api/frigate/notifications/{{msg.payload.id}}/snapshot.jpg"
}
};
msg.attachments = 'http://192.168.1.15:8123/api/frigate/notifications/{{msg.payload.id}}/snapshot.jpg';
return msg;
I’ve been able to send the snapshot using a hard coded event id, but I need help getting the actual id from the event.
The other thing that I want to do is to get the values from the payload into a Switch node to create conditional flows.
Can you help me do this?