I have set up a OpenMQTTGateway which is connected to OH2
A PIR Sensor sends a 443Mhz String 11349821 to openhab2
my.items
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”
when
Item FLURPI1RRAW changed
then
sendCommand(FLURPI1RRAW, ON)
timer = createTimer(now.plusSeconds(3)) [|
postUpdate(FLURPI1RRAW, OFF)
timer = null // reset the timer
])
end
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