Hey sorry for reviving this old thread, but I have a solution. You need the node red companion integration, or make your own helper switch as a global variable.
Node-RED flow:
[{"id":"5e493d979a418358","type":"server-state-changed","z":"7637b56b8946f3d3","name":"motion sensor","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"","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"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":720,"wires":[["75e8eab7ba6ec40f","5b1e5f97505027a3"]]},{"id":"57ac732c02b9cb06","type":"ha-binary-sensor","z":"7637b56b8946f3d3","name":"Living room","entityConfig":"0cab877b7da09143","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":830,"y":760,"wires":[[]]},{"id":"75e8eab7ba6ec40f","type":"change","z":"7637b56b8946f3d3","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":760,"wires":[["57ac732c02b9cb06"]]},{"id":"8d73bab8b8768278","type":"change","z":"7637b56b8946f3d3","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":720,"wires":[["57ac732c02b9cb06"]]},{"id":"5b1e5f97505027a3","type":"trigger","z":"7637b56b8946f3d3","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"5","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":510,"y":720,"wires":[["8d73bab8b8768278"]]},{"id":"c879ac61.99cd1","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"numeric","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"0cab877b7da09143","type":"ha-entity-config","server":"c879ac61.99cd1","deviceConfig":"a9908c2391584a3e","name":"Chris' room","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Chris' room"},{"property":"icon","value":"mdi:account-arrow-left"},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"occupancy"}],"resend":false,"debugEnabled":false},{"id":"a9908c2391584a3e","type":"ha-device-config","name":"Occupancy","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]