When I push my zwave button (Hank SCN04 Z-Wave Scene Controller with 4 buttons), I see that my script reacts badly. I assume the button sends the command multiple times. At least, I see it several times in my openhab.log file.
It’s possible that it’s us, humans, who push the button several times.
It’s afterall a small button, with a not-high-qualitly-‘click’-system.
Item:
> Number Sch_Bed "Bed Ouderkamer" <contact> { channel="zwave:device:30038385:node89:scene_number" }
My rule:
when
Item Sch_Bed received update
then
if (Sch_Bed.state == 1.0) {
logInfo("Hal", "Bed Knop 1, Slaap gedrukt")
if (HouseMode.state != "statussleep") {
HouseMode.sendCommand("statussleep")
}
else
HouseMode.sendCommand("statushome")
}
if (Sch_Bed.state == 2.0) {
...
Log output:
log/openhab.log:2020-04-29 22:41:09.956 [INFO ] [g.eclipse.smarthome.model.script.Hal] - Bed Knop 4, Alles uit
log/events.log: 2020-04-29 22:41:09.957 [ome.event.ItemCommandEvent] - Item 'HouseMode' received command statusaway
log/events.log: 2020-04-29 22:41:09.962 [vent.ItemStateChangedEvent] - HouseMode changed from NULL to statusaway
log/openhab.log:2020-04-29 22:41:12.777 [INFO ] [eclipse.smarthome.model.script.Modus] - Het huis werd in de status WEG geplaatst, en alarm wordt straks ACTIEF.
log/openhab.log:2020-04-29 22:41:12.777 [INFO ] [g.eclipse.smarthome.model.script.Hal] - Bed Knop 4, Alles uit
log/openhab.log:2020-04-29 22:41:12.777 [INFO ] [g.eclipse.smarthome.model.script.Hal] - Bed Knop 4, Alles uit
log/events.log: 2020-04-29 22:41:12.837 [ome.event.ItemCommandEvent] - Item 'HouseMode' received command statushome
log/events.log: 2020-04-29 22:41:12.838 [ome.event.ItemCommandEvent] - Item 'HouseMode' received command statushome
log/events.log: 2020-04-29 22:41:13.133 [vent.ItemStateChangedEvent] - HouseMode changed from statusaway to statushome
Is there something I can (should) do in my rule? A kind of ‘timeout’ / ‘waiting time’?
Or is there something I can do with my item/device?