I am using a radar motion detector to control a Sonoff switch. The attached flow should work properly:
Turn on the light when there is a person present (as the motion detector outputs a 0 when there is no movement I have a 60 second delay)
re-trigger the delay when the input goes high.
if no re-trigger is detected after 60 seconds turn the lights off.
Unfortunately it sometimes turns the light off while I am in the kitchen - it should only do this if I stood still for more than a minute, or a minute after I left the kitchen.
Any ideas?
[{"id":"bac35e27.86dba","type":"switch","z":"5ec24809.6385f8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","outputs":1,"x":290,"y":40,"wires":[["3390c219.16c96e"]]},{"id":"3390c219.16c96e","type":"trigger","z":"5ec24809.6385f8","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"60","extend":true,"units":"s","reset":"","name":"","x":462,"y":41,"wires":[["cc0ba35f.7fa24"]]},{"id":"ec703b42.772b98","type":"inject","z":"5ec24809.6385f8","name":"Test","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":110,"y":100,"wires":[["bac35e27.86dba"]]},{"id":"9c9bf1ea.952d4","type":"rpi-gpio in","z":"5ec24809.6385f8","name":"Motion - Kitchen","pin":"13","intype":"tri","debounce":"10","read":true,"x":109,"y":38,"wires":[["bac35e27.86dba"]]},{"id":"cc0ba35f.7fa24","type":"change","z":"5ec24809.6385f8","name":"Sonoff","rules":[{"t":"set","p":"topic","pt":"msg","to":"cmnd/kitchenlamp/power","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":80,"wires":[["c2806e4f.8b20d","fd54a316.4ac99"]]},{"id":"c2806e4f.8b20d","type":"mqtt out","z":"5ec24809.6385f8","name":"","topic":"","qos":"2","retain":"false","broker":"b675967b.bf7508","x":779.5,"y":118,"wires":[]},{"id":"fd54a316.4ac99","type":"debug","z":"5ec24809.6385f8","name":"","active":true,"console":"false","complete":"false","x":770,"y":60,"wires":[]},{"id":"b675967b.bf7508","type":"mqtt-broker","z":"","broker":"192.168.1.133","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]