After getting it up and running with only minor bumps on the way, I noticed a huge flaw. (This might also be due to my inability to configure it better but nevertheless it worked flawlessly in the previous version).
I have a gateway picking up my 433 MHz remotes and spitting them onto mqtt. The remotes I’m using put out a command more than once per second. As I use these commands to trigger several lights, and it is unnecessary to toggle them more than once per (half) a second, I used the following rule (partly shown)
if (gateway_ReceiveCommand.state == 42345 && schlafzimmer_deckenlampe.lastUpdate.isBefore(now.minusMillis(600))) {
if (schlafzimmer_deckenlampe.previousState.state == OFF) {
schlafzimmer_deckenlampe.send(ON)
} else {
schlafzimmer_deckenlampe.send(OFF)
}
}
This worked fine, but it seems now (at least with MapDB persistence) the timestamp only accurate to seconds is stored.
I tried using sth like now.minus(600, ChronoUnit.MILLIS), but still the light would flicker around thrice per second.
For now, I changed to
if (gateway_ReceiveCommand.state == 42345 && schlafzimmer_deckenlampe.lastUpdate.isBefore(now.minusSeconds(1))) {
if (schlafzimmer_deckenlampe.previousState.state == OFF) {
schlafzimmer_deckenlampe.send(ON)
} else {
schlafzimmer_deckenlampe.send(OFF)
}
}
but this is only barely usable, as it still sometimes triggers the light change twice.
Any idea where I took a wrong turn or what to change?
I’m using around 16 different remote codes to do different stuff, if this should be important