So I've tried it but can;t get it to do what I hoped. The goal is to have the red light come on when any or all doors are left open. All doors have to be closed for the red light to go out. I've modified it to recognise 4 doors. Now it still sends a right light on when I open any door which is fine but it sends a red light on when I close the last door.
Should I duplicate the AND flow to turn out the light. I guess what I need to do is an OR to turn the light on and an AND to turn the light off.
thanks
(I've yet to master sending a flow as a single line and how to attach an image)
[{"id":"7488976d271d4144","type":"server-state-changed","z":"668a17e2bbad24f9","name":"Garage Door 3 ","server":"ee1bb5a.f1bd648","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.shelly1_e89f6d867d60_input","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":100,"y":440,"wires":[["97f236a9171eb921"]]},{"id":"fa205c0c030ec3c5","type":"e-mail","z":"668a17e2bbad24f9","server":"smtp.gmail.com","port":"465","secure":true,"tls":false,"name":"xx@gmail.com","dname":"","credentials":{},"x":1080,"y":260,"wires":[]},{"id":"704ed674238bf2ea","type":"server-state-changed","z":"668a17e2bbad24f9","name":"Garage Door 1","server":"ee1bb5a.f1bd648","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.shelly1_58bf25d86793_input","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":100,"y":240,"wires":[["44f0fa42e1df5554"]]},{"id":"f4dbd6ea65404d7c","type":"server-state-changed","z":"668a17e2bbad24f9","name":"Garage Door 2","server":"ee1bb5a.f1bd648","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.shelly1_e89f6d85c8b5_input","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":100,"y":340,"wires":[["830fff4202fc76b0"]]},{"id":"d7b1d831720fe286","type":"server-state-changed","z":"668a17e2bbad24f9","name":"Garage Door 4","server":"ee1bb5a.f1bd648","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.shelly1_e89f6d85f316_input","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":100,"y":540,"wires":[["7d028ed5047a48c6"]]},{"id":"609d8a7c5ac63479","type":"debug","z":"668a17e2bbad24f9","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":220,"wires":[]},{"id":"01e3c2146b7843fe","type":"change","z":"668a17e2bbad24f9","name":"Change payload from \"off\" to \"Open\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage Door 1 Open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage Door 1 Open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":220,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11","20ed879a3da257d8"]]},{"id":"44f0fa42e1df5554","type":"switch","z":"668a17e2bbad24f9","name":"Is door 1 sensor on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":360,"y":240,"wires":[["01e3c2146b7843fe"],["ab048aa7ce35395c"]]},{"id":"ab048aa7ce35395c","type":"change","z":"668a17e2bbad24f9","name":"Change Payload from \"on\" to \"Closed\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage door 1 Closed","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage door 1 Closed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":260,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11"]]},{"id":"a7c6b18ef7501874","type":"change","z":"668a17e2bbad24f9","name":"Change payload from \"off\" to \"Open\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage Door 2 Open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage Door 2 Open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":320,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11","20ed879a3da257d8"]]},{"id":"830fff4202fc76b0","type":"switch","z":"668a17e2bbad24f9","name":"Is door 2 sensor on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":340,"wires":[["a7c6b18ef7501874"],["06da9a360da85242"]]},{"id":"06da9a360da85242","type":"change","z":"668a17e2bbad24f9","name":"Change Payload from \"on\" to \"Closed\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage door 2 Closed","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage door 2 Closed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":360,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11"]]},{"id":"735ef0a8fcb58640","type":"change","z":"668a17e2bbad24f9","name":"Change payload from \"off\" to \"Open\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage Door 3 Open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage Door 3 Open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":420,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11","20ed879a3da257d8"]]},{"id":"97f236a9171eb921","type":"switch","z":"668a17e2bbad24f9","name":"Is door 3 sensor on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":440,"wires":[["735ef0a8fcb58640"],["fde4fc671ff82d4d"]]},{"id":"fde4fc671ff82d4d","type":"change","z":"668a17e2bbad24f9","name":"Change Payload from \"on\" to \"Closed\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage door 3 Closed","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage door 3 Closed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":480,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11","20ed879a3da257d8"]]},{"id":"7a6012c047a8ad73","type":"change","z":"668a17e2bbad24f9","name":"Change payload from \"off\" to \"Open\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage Door 4 Open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage Door 4 Open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":520,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11","20ed879a3da257d8"]]},{"id":"7d028ed5047a48c6","type":"switch","z":"668a17e2bbad24f9","name":"Is door 4 sensor on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":540,"wires":[["7a6012c047a8ad73"],["9855e95d1c1a6a8e"]]},{"id":"9855e95d1c1a6a8e","type":"change","z":"668a17e2bbad24f9","name":"Change Payload from \"on\" to \"Closed\"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Garage door 4 Closed","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Garage door 4 Closed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":560,"wires":[["609d8a7c5ac63479","fa205c0c030ec3c5","259f5c414b2511af","80f5e00ec747cb11"]]},{"id":"b2e634922583d9c5","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door1","payload":"closed","payloadType":"str","x":110,"y":740,"wires":[["259f5c414b2511af"]]},{"id":"4144242088f7de52","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door2","payload":"closed","payloadType":"str","x":110,"y":780,"wires":[["259f5c414b2511af"]]},{"id":"83a66c4338a8fcc9","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door3","payload":"closed","payloadType":"str","x":110,"y":820,"wires":[["259f5c414b2511af"]]},{"id":"259f5c414b2511af","type":"change","z":"668a17e2bbad24f9","name":"translate","rules":[{"t":"change","p":"payload","pt":"msg","from":"closed","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"open","fromt":"str","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":780,"wires":[["572cc408cdd98a73"]]},{"id":"caebd5c3a86638ce","type":"switch","z":"668a17e2bbad24f9","name":"AND?","property":"$reduce(payload.*,function($i, $j){$i and $j})","propertyType":"jsonata","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":780,"wires":[["98cb03e971e255d2"]],"info":"# All properties of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n \"Office\": true,\n \"Bedroom\": true,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n \"Office\": true,\n \"Bedroom\": false,\n \"Living Room Balcony\": true,\n \"Living Room Right Window\": true,\n \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": true,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n \"Büro Balkon\": true,\n \"Schlafzimmer Balkon\": true,\n \"Wohnzimmer Balkon\": true,\n \"Wohnzimmer rechtes Fenster\": false,\n \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false."},{"id":"2fc54673c462631e","type":"debug","z":"668a17e2bbad24f9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":780,"wires":[]},{"id":"572cc408cdd98a73","type":"join","z":"668a17e2bbad24f9","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":780,"wires":[["caebd5c3a86638ce"]]},{"id":"98cb03e971e255d2","type":"change","z":"668a17e2bbad24f9","name":"set red light off","rules":[{"t":"set","p":"topic","pt":"msg","to":"alarm","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"red light off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":780,"wires":[["2fc54673c462631e"]]},{"id":"139181a298d6e0a7","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door4","payload":"closed","payloadType":"str","x":110,"y":860,"wires":[["259f5c414b2511af"]]},{"id":"80f5e00ec747cb11","type":"ttsultimate","z":"668a17e2bbad24f9","name":"","voice":"en-GB","ssml":false,"sonosipaddress":"192.168.1.72","sonosvolume":"60","sonoshailing":"0","config":"e1a4e0a0aeec9faf","property":"payload","propertyType":{},"rules":[{"host":"192.168.1.77","hostVolumeAdjust":"0"},{"host":"192.168.1.75","hostVolumeAdjust":"0"},{"host":"192.168.1.71","hostVolumeAdjust":"0"},{"host":"192.168.1.228","hostVolumeAdjust":"0"},{"host":"192.168.1.76","hostVolumeAdjust":"0"},{"host":"192.168.1.73","hostVolumeAdjust":"0"}],"playertype":"sonos","speakingrate":"1","speakingpitch":"0","unmuteIfMuted":true,"x":1070,"y":300,"wires":[[],[]]},{"id":"2e1d95b15c69dbbe","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"testing","payload":"testing","payloadType":"str","x":110,"y":160,"wires":[[]]},{"id":"20ed879a3da257d8","type":"debug","z":"668a17e2bbad24f9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":740,"wires":[]},{"id":"3a05c1c954327a42","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door1","payload":"open","payloadType":"str","x":110,"y":920,"wires":[["259f5c414b2511af","2fc54673c462631e"]]},{"id":"c1da656073b75e05","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door2","payload":"open","payloadType":"str","x":110,"y":960,"wires":[["259f5c414b2511af","2fc54673c462631e"]]},{"id":"ae43961771c44b50","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door3","payload":"open","payloadType":"str","x":110,"y":1000,"wires":[["259f5c414b2511af","2fc54673c462631e"]]},{"id":"f9e0d1e0a4f76bad","type":"inject","z":"668a17e2bbad24f9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"door4","payload":"open","payloadType":"str","x":110,"y":1040,"wires":[["259f5c414b2511af","2fc54673c462631e"]]},{"id":"ee1bb5a.f1bd648","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"e1a4e0a0aeec9faf","type":"ttsultimate-config","name":"Sonos TTS Service","noderedipaddress":"AUTODISCOVER","noderedport":"1980","purgediratrestart":"leave","ttsservice":"googletranslate","TTSRootFolderPath":""}]