Here’s what I’ve come up with so far.
`
[{"id":"cade29564877d530","type":"server-state-changed","z":"b296b2244ceada51","name":"Upstair Garage Light","server":"77d153ff.91140c","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.switch_test","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"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"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":180,"wires":[["69596713019e68dc"],["6a18ebc4a5b660f3"]]},{"id":"6a18ebc4a5b660f3","type":"api-get-history","z":"b296b2244ceada51","name":"Downstairs Light History","server":"77d153ff.91140c","version":0,"startdate":"","enddate":"","entityid":"switch.outlet_south_dormer","entityidtype":"is","useRelativeTime":true,"relativeTime":"20 sec","flatten":false,"output_type":"array","output_location_type":"msg","output_location":"payload","x":170,"y":340,"wires":[["1cd9dfb822828de6","aeae24c03b074e60"]]},{"id":"69596713019e68dc","type":"api-current-state","z":"b296b2244ceada51","name":"Light Off?","server":"77d153ff.91140c","version":2,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.outlet_south_dormer","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":100,"wires":[["699e9f294ffcf19c"],[]],"outputLabels":["true","false"]},{"id":"1cd9dfb822828de6","type":"debug","z":"b296b2244ceada51","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":380,"wires":[]},{"id":"aeae24c03b074e60","type":"function","z":"b296b2244ceada51","name":"Check Garage Light History","func":"// Check the history of the downstairs garage lights within timeframe and if they were off\n// then allow the upstairs garage light to turn off downstairs lights as well\nif(msg.payload[0] && msg.payload[0].filter(item => item.state == \"off\").length) {\n return msg;\n}\n\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":280,"wires":[["b3d0389845fe3617"]]},{"id":"699e9f294ffcf19c","type":"api-call-service","z":"b296b2244ceada51","name":"Turn on Downstairs Garage Light","server":"77d153ff.91140c","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.outlet_south_dormer","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":100,"wires":[[]]},{"id":"b3d0389845fe3617","type":"api-call-service","z":"b296b2244ceada51","name":"Turn Off Downstairs Garage Light","server":"77d153ff.91140c","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.outlet_south_dormer","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":180,"wires":[[]]},{"id":"77d153ff.91140c","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Seems to work but not sure about my function.