Block a node if in away mode?

I have the following flow but I am unsure as to how to go about blocking the disarm morning and armed night trigger when the house is in armed away mode. The disarm and arm nightly is on a timed trigger. any help would be greatly appreciated.

[{"id":"e2fc270f.37d188","type":"server-state-changed","z":"7264ac6a.c77464","name":"Home Alarm Mode","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"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":true,"x":130,"y":360,"wires":[["a1b6bdd7.590e2"]]},{"id":"a1b6bdd7.590e2","type":"switch","z":"7264ac6a.c77464","name":"Set Alarm Mode","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"armed_away","vt":"str"},{"t":"eq","v":"armed_night","vt":"str"},{"t":"eq","v":"disarmed","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":680,"y":420,"wires":[["b5913f00.2b3e8"],["ab92301a.72909"],["a22008d6.52e118"]]},{"id":"b5913f00.2b3e8","type":"api-call-service","z":"7264ac6a.c77464","name":"Armed Away","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_arm_away","entityId":"alarm_control_panel.ha_alarm","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":910,"y":320,"wires":[[]]},{"id":"ab92301a.72909","type":"api-call-service","z":"7264ac6a.c77464","name":"Armed Night","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_arm_night","entityId":"alarm_control_panel.ha_alarm","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1050,"y":380,"wires":[[]]},{"id":"a22008d6.52e118","type":"api-call-service","z":"7264ac6a.c77464","name":"Disarmed","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_disarm","entityId":"alarm_control_panel.ha_alarm","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":880,"y":460,"wires":[["6787664c.5b1068"]]},{"id":"4339065e.2e4fb8","type":"api-call-service","z":"7264ac6a.c77464","name":"Disarm","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_disarm","entityId":"alarm_control_panel.ha_alarm","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":220,"wires":[["5b35a2be.698a7c","a1b6bdd7.590e2"]]},{"id":"5e408061.f3e09","type":"thingzi-timer","z":"7264ac6a.c77464","name":"Disarm Morming @ 6:30 am","timerType":"trigger","startupMessage":false,"ontype":"tod","ontimesun":"dusk","ontimetod":"06:30","onpropertytype":"msg","onproperty":"payload","onvaluetype":"str","onvalue":"disarmed","onoffset":"","onrandomoffset":false,"offtype":"tod","offtimesun":"dawn","offtimetod":"","offpropertytype":"msg","offproperty":"payload","offvaluetype":"str","offvalue":"OFF","offoffset":"","offrandomoffset":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":140,"y":120,"wires":[["4339065e.2e4fb8"]]},{"id":"5b35a2be.698a7c","type":"debug","z":"7264ac6a.c77464","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":220,"wires":[]},{"id":"2302b111.05949e","type":"thingzi-timer","z":"7264ac6a.c77464","name":"Armed Night @ 10:30 pm","timerType":"trigger","startupMessage":false,"ontype":"tod","ontimesun":"dusk","ontimetod":"22:30","onpropertytype":"msg","onproperty":"payload","onvaluetype":"str","onvalue":"armed_night","onoffset":"","onrandomoffset":false,"offtype":"tod","offtimesun":"dawn","offtimetod":"","offpropertytype":"msg","offproperty":"payload","offvaluetype":"str","offvalue":"OFF","offoffset":"","offrandomoffset":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":130,"y":240,"wires":[["29563959.01e096"]]},{"id":"29563959.01e096","type":"api-call-service","z":"7264ac6a.c77464","name":"Armed Night","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_arm_night","entityId":"alarm_control_panel.ha_alarm","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":510,"y":300,"wires":[["a1b6bdd7.590e2"]]},{"id":"6d5b81b3.d33f5","type":"server-state-changed","z":"7264ac6a.c77464","name":"Armed Away Not Home","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"group.home_group","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"not_home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":440,"wires":[["342c09f1.457496"],[]],"outputLabels":["not_home","none"]},{"id":"1de6b8c9.2a8127","type":"server-state-changed","z":"7264ac6a.c77464","name":"Home Disarm Security","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"group.home_group","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":540,"wires":[["6edd0027.d1341"],[]],"outputLabels":["home","none"]},{"id":"342c09f1.457496","type":"change","z":"7264ac6a.c77464","name":"Switch OutPut","rules":[{"t":"change","p":"payload","pt":"msg","from":"not_home","fromt":"str","to":"armed_away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":440,"wires":[["a1b6bdd7.590e2"]]},{"id":"6edd0027.d1341","type":"change","z":"7264ac6a.c77464","name":"Switch OutPut","rules":[{"t":"change","p":"payload","pt":"msg","from":"home","fromt":"str","to":"disarmed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":500,"wires":[["a1b6bdd7.590e2"]]},{"id":"e145c1d5.ed3ad","type":"server-state-changed","z":"7264ac6a.c77464","name":"Manual Disarm","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"alarm_control_panel.ha_alarm","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"disarmed","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":120,"y":600,"wires":[["a1b6bdd7.590e2"],[]],"outputLabels":["disarmed","none"]},{"id":"6787664c.5b1068","type":"api-call-service","z":"7264ac6a.c77464","name":"Turn Off Garage Siren","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_siren_switch","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1240,"y":440,"wires":[[]]},{"id":"f30b858c.4b4a58","type":"comment","z":"7264ac6a.c77464","name":"Home Assistant Alarm Panel","info":"","x":190,"y":40,"wires":[]}]

For this sort of requirement I use the node-red-contrib-simple-gate node. You can control whether the gate is open or closed based on your own logic. So for example, you could have a gate in the disarm morning flow, and close it when the house is in armed away mode.

To get it to work as expected over deploys/restarts you would also have to tick the "Restore from saved state" option, and have persistent context enabled.

2 Likes

Hi Thanks for the reply..

The gate option looks like it will fit my needs perfectly but I am wonder how do I get it to block and unblock at the set times the trigger goes off.

Thanks!

The tigger will still fire, but if the gate is immediately after the trigger, it will block the message from continuing the flow. Then you have other input(s) to the trigger that control whether the gate is open or closed. For example, to have the flow blocked from 10pm to 7am:

[{"id":"4b174f9a.364e6","type":"inject","z":"55641a31.a79154","name":"Open @ 7am","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 07 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":200,"y":200,"wires":[["1c1279c.57de686"]]},{"id":"1c1279c.57de686","type":"gate","z":"55641a31.a79154","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":true,"x":410,"y":100,"wires":[["f5e382b4.e4ff4"]]},{"id":"3c36ceee.84d032","type":"inject","z":"55641a31.a79154","name":"Close @ 10pm","props":[{"p":"payload","v":"close","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":200,"y":160,"wires":[["1c1279c.57de686"]]},{"id":"2e9c6fb2.736d1","type":"trigger-state","z":"55641a31.a79154","name":"","server":"","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":190,"y":100,"wires":[["1c1279c.57de686"],[]]},{"id":"f5e382b4.e4ff4","type":"debug","z":"55641a31.a79154","name":"Rest of flow","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":100,"wires":[]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.