Hi,
I am looking to translate the following yaml automation to node-red:
- id: motion_notification
alias: Motion Notification
action:
- service: notify.po_parents
data_template:
data:
title: ‘HomeAssistant:’
priority: 1
message: >
{{ trigger.to_state.attributes.friendly_name }} has detected movement
condition:- condition: state
entity_id: input_boolean.motion_notifications
state: ‘on’
trigger:- entity_id: binary_sensor.living_room_pir_livingroom, binary_sensor.hallway_pir_hallway
platform: state
to: ‘on’
I have come up with the following so far:
[{“id”:“ae9bd860.008a08”,“type”:“server-state-changed”,“z”:“96acd1d9.4ecc9”,“name”:“Motion Sensors”,“server”:“38f6340d.e8cf4c”,“entityidfilter”:“^binary_sensor\.\w+pir\w+”,“entityidfiltertype”:“regex”,“haltifstate”:“”,“x”:88.5,“y”:293,“wires”:[[“fe642cb8.4cb5a”,“543926d8.2a2658”]]},{“id”:“fe642cb8.4cb5a”,“type”:“debug”,“z”:“96acd1d9.4ecc9”,“name”:“”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“x”:826.5,“y”:181,“wires”:},{“id”:“543926d8.2a2658”,“type”:“switch”,“z”:“96acd1d9.4ecc9”,“name”:“”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“off”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:283.5,“y”:291,“wires”:[[“1d83c025.14333”],]},{“id”:“1d83c025.14333”,“type”:“api-current-state”,“z”:“96acd1d9.4ecc9”,“name”:“Tracking Motion”,“server”:“38f6340d.e8cf4c”,“halt_if”:“off”,“override_topic”:true,“override_payload”:true,“entity_id”:“input_boolean.motion_notifications”,“x”:455.5,“y”:286,“wires”:[[“d70b838a.25963”,“fe642cb8.4cb5a”]]},{“id”:“d2aa6688.471f98”,“type”:“api-call-service”,“z”:“96acd1d9.4ecc9”,“name”:“Notify Parents”,“server”:“38f6340d.e8cf4c”,“service_domain”:“notify”,“service”:“po_parents”,“data”:“{}”,“mergecontext”:“”,“x”:931.5,“y”:283,“wires”:[]},{“id”:“d70b838a.25963”,“type”:“function”,“z”:“96acd1d9.4ecc9”,“name”:“Format Message”,“func”:“var newmsg = {payload:'"title":"homeassistant", "priority":"1", "message": ’ + msg.data.attributes.friendly_name + ‘"has detected movement"’};\nreturn newmsg;”,“outputs”:1,“noerr”:0,“x”:686.5,“y”:284,“wires”:[[“d2aa6688.471f98”,“fe642cb8.4cb5a”]]},{“id”:“38f6340d.e8cf4c”,“type”:“server”,“z”:“”,“name”:“HomeAssistant”,“url”:“http://192.168.1.190:8123”,“pass”:“xxxxx”}]
The regex is matching events from all my pir zwave sensors. I then want to check if motion_sensor alerting is switched on. Plan is to then send a notification (via Pushover) including the friendly name of the sensor that has been triggered.
The friendly name that gets captured is of course the friendly name of the “input_boolean.motion_notification” as that is the last payload I generated. I’ve lost the motion sensor payload along the way.
This is a long way from working and I could use some advice?