Java Runtime Environment: openjdk version “1.8.0_152”
openHAB version: Openhab 2
Issue of the topic: With my garage door setup I use a reed switch to determine if the door is open or closed. Each time the garage door moves, it produces 3 events:
2019-02-22 09:23:02.287 [vent.ItemStateChangedEvent] - garageState1 changed from OPEN to CLOSED
2019-02-22 09:23:02.641 [vent.ItemStateChangedEvent] - garageState1 changed from CLOSED to OPEN
2019-02-22 09:23:02.652 [vent.ItemStateChangedEvent] - garageState1 changed from OPEN to CLOSED
I believe this is due to the switch passing over the magnet.
Is there any way to ignore the first 2 events and only report the last one?
My rule sends notification with the change in state:
rule “Main Garage Open”
when
Item garageState1 changed from CLOSED to OPEN
then
Echo_MusicBox_TTS.sendCommand(‘Main Garage Door Open’)
end
Wired reed switches are so inexpensive it might be worth replacing them with one that exhibits a better behavior. I do not see this same behavior with my reed sensors.
There is no easy way to do this. What you would have to do is create a Timer on the first event, return from the Rule when the timer exists, and in the body of the timer check the state of the sensor and report that when the timer goes off.