How about using flow variables to store the state, combining the states whenever there is a change, filtering so it only does something the first time, testing if both are off and then switching your light?
[{“id”:“95e16713a2b71b2e”,“type”:“server-state-changed”,“z”:“b1509d67db32a5cf”,“name”:“occ1”,“server”:“dd8709036f041c5f”,“version”:5,“outputs”:2,“exposeAsEntityConfig”:“”,“entityId”:“binary_sensor.hallmovement_occupancy”,“entityIdType”:“exact”,“outputInitially”:true,“stateType”:“str”,“ifState”:“on”,“ifStateType”:“str”,“ifStateOperator”:“is”,“outputOnlyOnStateChange”: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”:190,“y”:180,“wires”:[[“bd0efc1e79433c95”],[“bd0efc1e79433c95”]]},{“id”:“5e980c65e900acb7”,“type”:“server-state-changed”,“z”:“b1509d67db32a5cf”,“name”:“occ2”,“server”:“dd8709036f041c5f”,“version”:5,“outputs”:2,“exposeAsEntityConfig”:“”,“entityId”:“binary_sensor.hallmovement_occupancy”,“entityIdType”:“exact”,“outputInitially”:true,“stateType”:“str”,“ifState”:“on”,“ifStateType”:“str”,“ifStateOperator”:“is”,“outputOnlyOnStateChange”: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”:190,“y”:220,“wires”:[[“39c43a200f8c6730”],[“39c43a200f8c6730”]]},{“id”:“bd0efc1e79433c95”,“type”:“change”,“z”:“b1509d67db32a5cf”,“name”:“store occ1”,“rules”:[{“t”:“set”,“p”:“occ1”,“pt”:“flow”,“to”:“payload”,“tot”:“msg”}],“action”:“”,“property”:“”,“from”:“”,“to”:“”,“reg”:false,“x”:340,“y”:180,“wires”:[[“fc84f038554d38ac”]]},{“id”:“39c43a200f8c6730”,“type”:“change”,“z”:“b1509d67db32a5cf”,“name”:“store occ2”,“rules”:[{“t”:“set”,“p”:“occ2”,“pt”:“flow”,“to”:“payload”,“tot”:“msg”}],“action”:“”,“property”:“”,“from”:“”,“to”:“”,“reg”:false,“x”:340,“y”:220,“wires”:[[“fc84f038554d38ac”]]},{“id”:“fc84f038554d38ac”,“type”:“string”,“z”:“b1509d67db32a5cf”,“name”:“concat”,“methods”:[{“name”:“append”,“params”:[{“type”:“flow”,“value”:“occ1”}]},{“name”:“append”,“params”:[{“type”:“flow”,“value”:“occ2”}]}],“prop”:“”,“propout”:“payload”,“object”:“str”,“objectout”:“msg”,“x”:490,“y”:200,“wires”:[[“4e3c1e6aaa32c592”]]},{“id”:“4e3c1e6aaa32c592”,“type”:“rbe”,“z”:“b1509d67db32a5cf”,“name”:“”,“func”:“rbe”,“gap”:“”,“start”:“”,“inout”:“out”,“septopics”:true,“property”:“payload”,“topi”:“topic”,“x”:610,“y”:200,“wires”:[[“1d6388d69a1a7ebf”]]},{“id”:“1d6388d69a1a7ebf”,“type”:“switch”,“z”:“b1509d67db32a5cf”,“name”:“both off?”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“falsefalse”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:740,“y”:200,“wires”:[[“79aa5e62b18882ac”]]},{“id”:“79aa5e62b18882ac”,“type”:“api-call-service”,“z”:“b1509d67db32a5cf”,“name”:“lights”,“server”:“dd8709036f041c5f”,“version”:5,“debugenabled”:false,“domain”:“homeassistant”,“service”:“{{payload}}”,“areaId”:[“hallway”],“deviceId”:,“entityId”:,“data”:“”,“dataType”:“jsonata”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“x”:870,“y”:200,“wires”:[]},{“id”:“dd8709036f041c5f”,“type”:“server”,“name”:“Home Assistant”,“version”:5,“addon”:false,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true,“cacheJson”:true,“heartbeat”:false,“heartbeatInterval”:“30”,“areaSelector”:“friendlyName”,“deviceSelector”:“friendlyName”,“entitySelector”:“friendlyName”,“statusSeparator”:": ",“statusYear”:“hidden”,“statusMonth”:“short”,“statusDay”:“numeric”,“statusHourCycle”:“default”,“statusTimeFormat”:“h:m”,“enableGlobalContextStore”:false}]