Hi. I’m using node red for my home assistant alarm. I’m trying to integrate Automations into my flows.
I’m using a function node link to an email node, The email subjects works. the email body shows the below text instead of the alarm trigger
Copy to clipboard
{"data":{"message":"ALARM TRIGGERED!!! {{ states[states.alarm_control_panel.house.attributes.changed_by.split(\".\")[0]][ states.alarm_control_panel.house.attributes.changed_by.split(\".\")[1]].name }}"}}
Below is my function node code.
Copy to clipboard
msg.topic = "Home Assistant - Alert - Automation"
msg.payload = { "data": {message: 'ALARM TRIGGERED!!! {{ states[states.alarm_control_panel.house.attributes.changed_by.split(".")[0]][ states.alarm_control_panel.house.attributes.changed_by.split(".")[1]].name }}'} }
return msg;
Please help me fix my code so it shows which sensor triggered the alarm