Fibaro Motion sensor with Node-Red

Tags: #<Tag:0x00007f738f008ef8> #<Tag:0x00007f738f008868>

Hello, I have a Fibaro FGMS-001 motion sensor that I am trying to use with Node Red to turn on a light and back off after motion is done. I was following this guide

The problem I’ve encountered is as motion is continually detected it doesn’t repeatedly send the on state. So motion is detected, the switch turns on and starts the 35 second timer, if motion continues to be detected it doesn’t re-send the on to restart the timer so after 35 seconds the switch shuts off even though there is still motion. I’m not sure if I just have something setup wrong with the flow or the motion sensor or if this sensor doesn’t repeatedly send the updates.

If it doesn’t repeatedly send updates I was trying to configure it with a switch node for on/off and when off is sent have it start a 5 minute timer. But if motion is not detected for 30 seconds and it sends off it will start the timer, then motion is detected again a few seconds later it will send the on again but not restart the timer. Is it possible to set this up with this motion sensor or will I need a different sensor that sends the repeated messages as motion continues to be detected? Is there a recommended sensor?

I think you are looking at this the wrong way.
The sensor is a switch. When motion is detected, the switch turns on (and a signal is sent). Some (customizable) seconds after motion stops, the switch turns off again. This is just how any other switch works. I don’t know of any switches that will send a continuous signal for as long as they are on.

So when the sensor sends an “on”, you turn on the light.
And when the sensor sends the off signal, you turn the lights off.
To add a longer timeout before turning the lights off, in HA, you just add the “for” keyword to the trigger (not sure exactly how it is done in node red).
E.g. “To state off for 05:00”
That will trigger 5 minutes after the off-signal is received, and any new “on” before the 5 minutes are done will cancel that automatically.

I’m not using YAML/HA Automations though, I’m trying to use Node-Red so how do I make a new on cancel a pending 5 minute timer?

edit:

Ok, your post made me realize to google “cancel stop timer node-red” and I found another post on the forums here.

I set the on from the switch node to call the service to turn the switch on, and also output it to a change node that deletes the msg.payload and then sets msg.payload to STOP and output that to the input on the stop timer so if when it turns on, if there is a pending stop timer it will cancel it and not start the timer again until the motion sensor goes back to off. Thank you.