OpenMQTTGateway PIR Sensor reset item state

I have set up a OpenMQTTGateway which is connected to OH2
A PIR Sensor sends a 443Mhz String 11349821 to openhab2

Number FLURPI1RRAW “Bewegung Flur [%d]” {mqtt="<[openhab:home/OpenMQTTGateway/433toMQTT:state:default]"}

I added this item to my sitemap and it works.

If the PIR recognize a motion it sends 11349821 to the MQTT server, Openhab Interprate this as “Motion Detected” in the Sitemap.
But dont change back to the state “no motion detected”

I tried to fire an update of this item with a rule:

import org.openhab.model.script.actions.Timer

var Timer timer = null

rule “FLURPI1RRAW Reset”
Item FLURPI1RRAW changed
sendCommand(FLURPI1RRAW, ON)
timer = createTimer(now.plusSeconds(3)) [|
postUpdate(FLURPI1RRAW, OFF)
timer = null // reset the timer

The Problem is that the PIR only sends one string, for motion detected.

How can i reset the status of the item to “no motion detected”?
When the PIR fires the MQTT signal, reset it after 3 seconds to 0 and fire up after a new motion detection.

Thanks a lot :slight_smile:

Look into the expire binding. That will most likely do what you want.

Yes, great, thats what iam looking for! Thank you very much!

within this item it works:
{mqtt="<[openhab:home/OpenMQTTGateway/433toMQTT:state:default]", expire=“3s,state=0”}

1 Like

Great! Can you mark post as solved. Check box at bottom of the post that solved it.