In the flow below I can manually switch a Philips Hue lamp on and off with two switches.
I now also want to use a motion sensor to switch on the lamp when there is movement. But this should only work when the lamp is off.
How can I process this in a flow?
[{"id":"6f34922e.f4f04c","type":"tab","label":"LIGHT","disabled":false,"info":""},{"id":"31d96fcb.d1205","type":"function","z":"6f34922e.f4f04c","name":"SWITCH OFF","func":"msg.payload={\n\"on\":true,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":240,"wires":[["3071902b.77d5"]]},{"id":"80e3ef7f.34896","type":"inject","z":"6f34922e.f4f04c","name":"ON MANUAL","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":240,"wires":[["31d96fcb.d1205"]]},{"id":"a88033f9.61d93","type":"function","z":"6f34922e.f4f04c","name":"SWITCH OFF","func":"msg.payload={\n\"on\":false,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":160,"wires":[["3071902b.77d5"]]},{"id":"2c0e4152.43299e","type":"inject","z":"6f34922e.f4f04c","name":"OFF MANUAL","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":160,"wires":[["a88033f9.61d93"]]},{"id":"d6feb914.b10d78","type":"inject","z":"6f34922e.f4f04c","name":"ON MOTION","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":440,"wires":[["de3981b0.74f92"]]},{"id":"de3981b0.74f92","type":"function","z":"6f34922e.f4f04c","name":"SWITCH ON","func":"msg.payload={\n\"on\":true,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":440,"wires":[["3071902b.77d5"]]},{"id":"61fb1609.a49f68","type":"comment","z":"6f34922e.f4f04c","name":"ONLY IF LAMP IS OFF:","info":"","x":360,"y":380,"wires":[]},{"id":"daca803c.e8b67","type":"comment","z":"6f34922e.f4f04c","name":"MANUAL SWITCHES","info":"","x":260,"y":80,"wires":[]},{"id":"3071902b.77d5","type":"hue-light","z":"6f34922e.f4f04c","name":"LAMP","bridge":"6e5f1fd.c009ce","lightid":"25","colornamer":true,"skipevents":false,"universalevents":false,"x":730,"y":240,"wires":[[]]},{"id":"6e5f1fd.c009ce","type":"hue-bridge","name":"ToHa Bridge","bridge":"192.168.2.150","key":"ipXv8iEicQTW4xXBKoANKVkdRooBojYKrV3RQ2k8","interval":"3000","disableupdates":false}]