Trouble turning off light using SmartThings motion sensor

I’m still figuring out node red and how it works with Smartthings so apologies if this is a simple question.

That said I haven’t been able to figure out how to use the smartthings motion sensor effectively. From what I can tell I’m only getting a single msg event when motion is first detected.

I’m trying to create a motion activated light however I’m don't know how to do this effectively with only one event.

My Hue motion sensor on the other hand sends an additional msg after motion has stopped which allows me to turn the light off.

Any ideas on how to accomplish this with the Smartthings sensor?

Have you checked trigger node? It should be able to do this. First output turns the light on from moment and the second turns it of after delay.

Hi ristomatti, thx for the reply!

I tried using that after seeing mention of it in another thread however the SmartThings node requires setting msg.topic to “switch” in order to change the state.

Looking at the Trigger node it doesn’t seem possible to alter anything outside of msg.payload so I wasn’t sure how to go about setting this value?

You can use a switch node to check conditions and branch to different outputs or the change node to move data from one property to another.