Looking for examples of the trigger node

Hi, I’m looking for examples on the uses of the add constraints and add output properties. I’m trying to recreate the following yaml automation, but haven’t been able to make it work.

- alias: 'Trigger the alarm if in armed away'
  trigger:
    - platform: state
      entity_id: 
        - binary_sensor.front_door
        - binary_sensor.yard_door
        - binary_sensor.garage_door
        - binary_sensor.window_living_room_3_sensor
        - binary_sensor.window_living_room_4_sensor
        - binary_sensor.andrews_bedroom_window_sensor
        - binary_sensor.entrance_pir_sensor_motion
        - binary_sensor.living_room_motion_sensor_sensor
      to: 'on'
    - platform: state
      entity_id:
        - binary_sensor.visonic_mct340_e_0b000c64_1_1280
        - binary_sensor.visonic_mct340_e_0b0011fb_1_1280
        - binary_sensor.visonic_mct340_e_0b2a7984_1_1280
      to: 'open'
  condition:
    - condition: state
      entity_id: alarm_control_panel.ha_alarm
      state: armed_away
  action:
    service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.ha_alarm 

Basically, if the alarm is set to arm_away and any of those sensors change from off to on or closed to open trigger the alarm siren.

Try something like

[{"id":"1c0ccede.46bf91","type":"server-state-changed","z":"75a5ba8.f1c5d44","name":"Door Sensors","server":"73b62ee3.62986","entityidfilter":"binary_sensor\\.(front_door|yard_door|garage_door|window_living_room_3_sensor|window_living_room_4_sensor|andrews_bedroom_window_sensor|entrance_pir_sensor_motion|living_room_motion_sensor_sensor)","entityidfiltertype":"regex","haltifstate":"off","outputinitially":false,"x":95,"y":425,"wires":[["6eb17c91.3027e4"]]},{"id":"5b560865.f46c38","type":"server-state-changed","z":"75a5ba8.f1c5d44","name":"Window Sensors","server":"73b62ee3.62986","entityidfilter":"binary_sensor\\.(visonic_mct340_e_0b000c64_1_1280|visonic_mct340_e_0b0011fb_1_1280|visonic_mct340_e_0b2a7984_1_1280)","entityidfiltertype":"regex","haltifstate":"closed","outputinitially":false,"x":105,"y":475,"wires":[["6eb17c91.3027e4"]]},{"id":"6eb17c91.3027e4","type":"api-current-state","z":"75a5ba8.f1c5d44","name":"Alarm Away?","server":"73b62ee3.62986","halt_if":"","override_topic":true,"override_payload":true,"entity_id":"alarm_control_panel.ha_alarm","x":340,"y":450,"wires":[["c96bc523.1f8ad8"]]},{"id":"c96bc523.1f8ad8","type":"switch","z":"75a5ba8.f1c5d44","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"arm_away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":475,"y":450,"wires":[["aa4beb01.12f4f8"]]},{"id":"aa4beb01.12f4f8","type":"api-call-service","z":"75a5ba8.f1c5d44","name":"","server":"73b62ee3.62986","service_domain":"alarm_control_panel","service":"alarm_trigger","data":"{\"entity_id\": \"alarm_control_panel.ha_alarm\"}","mergecontext":"","x":700,"y":450,"wires":[[]]}]

You could use separate event state nodes for each sensor if you don’t want to deal with regex

4 Likes

What if you put the sensors in two groups in homeassistant ? That way you only have to check the groups state?

You hit the nail right on the head. I wasn’t aware you of regex and that you could string the entities in that manner, just learned something new.

@koen01, thanks for your suggestion as well, that would have worked also.