Cancel Alarm if I have left a door or window open?

I am trying to make a simple switch based on if a door or window is left open. If they are I will send a TTS notification and then cancel the alarm. Could you please take a look at my flow and suggest a better method? I can’t seem to use the trigger node as a switch.

[{"id":"546655ce.8cf07c","type":"tab","label":"Flow 10","disabled":false,"info":""},{"id":"445502de.82b2ac","type":"server-state-changed","z":"546655ce.8cf07c","name":"Home Alarm Mode","server":"ea5ed475.5c5908","version":1,"entityidfilter":"alarm_control_panel.ha_alarm","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":130,"y":100,"wires":[["fa4c91d5.0551"]]},{"id":"fa4c91d5.0551","type":"switch","z":"546655ce.8cf07c","name":"Filter Alarm Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"armed_home","vt":"str"},{"t":"eq","v":"armed_away","vt":"str"},{"t":"eq","v":"disarmed","vt":"str"},{"t":"eq","v":"triggered","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":330,"y":100,"wires":[["5e4f1dc1.4f54d4"],[],[],[]]},{"id":"5e4f1dc1.4f54d4","type":"trigger-state","z":"546655ce.8cf07c","name":"test","server":"ea5ed475.5c5908","entityid":"binary_sensor\\.(main_front_door|courtyard_door|back_door|status_laundry_door_sensor_xiaomi)+|binary_sensor\\.(\\w+window)","entityidfiltertype":"regex","debugenabled":true,"constraints":[{"id":"n40tymgxieg","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":610,"y":80,"wires":[["cc7ee14b.5397d"],["974651ff.2b13f"]]},{"id":"cc7ee14b.5397d","type":"debug","z":"546655ce.8cf07c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":840,"y":60,"wires":[]},{"id":"974651ff.2b13f","type":"debug","z":"546655ce.8cf07c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":840,"y":120,"wires":[]},{"id":"ea5ed475.5c5908","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

if using the homeassistant websocket node you can use the in property of the get entities node
then if state is on do what ever

i do this for my alarm system

more info here from the developer. Examples for using the new Get Entities node

[{“id”:“c7ae97cc.0c1a98”,“type”:“change”,“z”:“1c3e0cff.34d173”,“name”:“Change to timestamp”,“rules”:[{“t”:“set”,“p”:“payload”,“pt”:“msg”,“to”:"",“tot”:“date”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:150.43264770507812,“y”:638.6428833007812,“wires”:[[“bf7adaec.b7c638”]]},{“id”:“7060783.7d12888”,“type”:“api-call-service”,“z”:“1c3e0cff.34d173”,“name”:“Disarm Alarm”,“server”:“a4ffc1b3.ac473”,“version”:1,“service_domain”:“alarm_control_panel”,“service”:“alarm_disarm”,“entityId”:“alarm_control_panel.house”,“data”:"{“code”:“2304”}",“dataType”:“json”,“mergecontext”:"",“output_location”:“payload”,“output_location_type”:“msg”,“mustacheAltTags”:false,“x”:709.6866455078125,“y”:704.118896484375,“wires”:[[]]},{“id”:“bf7adaec.b7c638”,“type”:“api-current-state”,“z”:“1c3e0cff.34d173”,“name”:“Get Alarm State”,“server”:“a4ffc1b3.ac473”,“version”:1,“outputs”:1,“halt_if”:"",“halt_if_type”:“str”,“halt_if_compare”:“is”,“override_topic”:true,“entity_id”:“alarm_control_panel.house”,“state_type”:“str”,“state_location”:“payload”,“override_payload”:“msg”,“entity_location”:“data”,“override_data”:“msg”,“blockInputOverrides”:false,“x”:205.65484619140625,“y”:693.8968505859375,“wires”:[[“c6a5eef4.1b05a”]]},{“id”:“c6a5eef4.1b05a”,“type”:“switch”,“z”:“1c3e0cff.34d173”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“disarmed”,“vt”:“str”},{“t”:“eq”,“v”:“armed_home”,“vt”:“str”},{“t”:“eq”,“v”:“armed_away”,“vt”:“str”},{“t”:“eq”,“v”:“triggered”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:4,“x”:369.1666259765625,“y”:637.5594482421875,“wires”:[[“595399a5.40fc78”],[“7060783.7d12888”],[“7060783.7d12888”],[“7060783.7d12888”]]},{“id”:“51ddcba1.e8f584”,“type”:“api-call-service”,“z”:“1c3e0cff.34d173”,“name”:“Arm Alarm”,“server”:“a4ffc1b3.ac473”,“version”:1,“service_domain”:“alarm_control_panel”,“service”:“alarm_arm_home”,“entityId”:“alarm_control_panel.house”,“data”:"{“code”:“2304”}",“dataType”:“json”,“mergecontext”:"",“output_location”:“payload”,“output_location_type”:“msg”,“mustacheAltTags”:false,“x”:1005.479606628418,“y”:549.2498970031738,“wires”:[[]]},{“id”:“f5026b02.94d828”,“type”:“api-call-service”,“z”:“1c3e0cff.34d173”,“name”:“Notify”,“server”:“a4ffc1b3.ac473”,“version”:1,“service_domain”:“tts”,“service”:“google_say”,“entityId”:“media_player.master_bedroom_speaker”,“data”:"{“message”:“The {{payload}} is open.”}",“dataType”:“json”,“mergecontext”:"",“output_location”:“payload”,“output_location_type”:“msg”,“mustacheAltTags”:false,“x”:985.2868041992188,“y”:655.4601516723633,“wires”:[[]]},{“id”:“7bb643c3.c492fc”,“type”:“switch”,“z”:“1c3e0cff.34d173”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“empty”},{“t”:“else”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:846.2868537902832,“y”:587.4602236747742,“wires”:[[“51ddcba1.e8f584”],[“27b40f52.d90d9”]]},{“id”:“27b40f52.d90d9”,“type”:“split”,“z”:“1c3e0cff.34d173”,“name”:"",“splt”:"\n",“spltType”:“str”,“arraySplt”:1,“arraySpltType”:“len”,“stream”:false,“addname”:"",“x”:985.2869300842285,“y”:603.4602808952332,“wires”:[[“ee4b0164.a47cf”]]},{“id”:“ee4b0164.a47cf”,“type”:“template”,“z”:“1c3e0cff.34d173”,“name”:"",“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:"{{payload.attributes.friendly_name}}",“output”:“str”,“x”:715.2867813110352,“y”:655.4602222442627,“wires”:[[“6555f559.efe95c”]]},{“id”:“6555f559.efe95c”,“type”:“join”,“z”:“1c3e0cff.34d173”,“name”:"",“mode”:“custom”,“build”:“string”,“property”:“payload”,“propertyType”:“msg”,“key”:“topic”,“joiner”:",",“joinerType”:“str”,“accumulate”:false,“timeout”:"",“count”:"",“reduceRight”:false,“reduceExp”:"",“reduceInit”:"",“reduceInitType”:"",“reduceFixup”:"",“x”:850.2867584228516,“y”:655.4602537155151,“wires”:[[“f5026b02.94d828”]]},{“id”:“595399a5.40fc78”,“type”:“ha-get-entities”,“z”:“1c3e0cff.34d173”,“server”:“a4ffc1b3.ac473”,“name”:"",“rules”:[{“property”:“entity_id”,“logic”:“includes”,“value”:“binary_sensor.kids_toilet_window,binary_sensor.ensuite_bathroom_window,binary_sensor.fr_1_window,binary_sensor.fr_2_window,binary_sensor.fr_3_window,binary_sensor.fr_4_bottom_window,binary_sensor.fr_4_top_window,binary_sensor.internal_garage_door,binary_sensor.kids_bathroom_window,binary_sensor.left_garage_door,binary_sensor.right_garage_door,binary_sensor.lounge_1_bottom_window,binary_sensor.lounge_1_top_window,binary_sensor.lounge_2_bottom_window,binary_sensor.lounge_2_top_window,binary_sensor.openclose_34,binary_sensor.openclose_35,binary_sensor.openclose_36,binary_sensor.openclose_37,binary_sensor.dani_bedroom_top_window,binary_sensor.spare_room_bottom_window,binary_sensor.spare_room_top_window,binary_sensor.yasmin_bedroom_top_window,binary_sensor.yasmin_bedroom_bottom_window,binary_sensor.dani_bedroom_bottom_window,binary_sensor.door_window_sensor_158d00019f6314,binary_sensor.door_window_sensor_158d00019f6320,binary_sensor.door_window_sensor_158d00019f6358,binary_sensor.door_window_sensor_158d00019f6380”,“valueType”:“str”},{“property”:“state”,“logic”:“is”,“value”:“on”,“valueType”:“str”}],“output_type”:“array”,“output_empty_results”:true,“output_location_type”:“msg”,“output_location”:“payload”,“output_results_count”:1,“x”:699.286642074585,“y”:594.4603080749512,“wires”:[[“7bb643c3.c492fc”]]},{“id”:“bda906ad.4a5dd8”,“type”:“server-events”,“z”:“1c3e0cff.34d173”,“name”:“Alarm Switch”,“server”:“a4ffc1b3.ac473”,“event_type”:“deconz_event”,“x”:95.5,“y”:564,“wires”:[[“cd8a65b3.8fd688”]]},{“id”:“cd8a65b3.8fd688”,“type”:“switch”,“z”:“1c3e0cff.34d173”,“name”:"",“property”:“payload.event.id”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“alarm_switch”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:265.5,“y”:569,“wires”:[[“c7ae97cc.0c1a98”]]},{“id”:“a4ffc1b3.ac473”,“type”:“server”,“z”:"",“name”:“Home Assistant”,“legacy”:false,“hassio”:false,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true}]

1 Like

I find it very useful. Thank you!! :sonriendo: