Trigger node problem

40 views
Skip to first unread message

Garry Hayne

unread,
Sep 21, 2017, 11:50:56 AM9/21/17
to Node-RED
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":""}]

Dave C-J

unread,
Sep 21, 2017, 12:23:14 PM9/21/17
to node...@googlegroups.com
looks ok at first glance...

Toshi Bass

unread,
Sep 21, 2017, 1:04:34 PM9/21/17
to Node-RED
For sure the flow is ok I have virtually the same flow currently working in my garage, I would check the pir I have one that has to see movement 3 times within a period of time to trigger, its supposed to prevent spurious triggering but I had the same problem as you, walking in my garage it would turn on the light but even though I could see the red led coming on it would only re-trigger with major movement so I could be in the garage in the dark after 1 minute even though I was not trying to stand still, actually I found a switch on the pcb of the pir that switched that feature off and now it works fine.

just to make sure I would disconnect the pir in your flow, set the trigger to 10 minutes and switch On the sonoff with inject node, if it stays on for 10 minutes then you can discount the sonoff code, mqtt and wifi issues then your only left with a pir problem.  
Reply all
Reply to author
Forward
0 new messages