Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active October 20, 2015 08:50
Show Gist options
  • Save digiltd/17c3bf4aacbfad3278c2 to your computer and use it in GitHub Desktop.
Save digiltd/17c3bf4aacbfad3278c2 to your computer and use it in GitHub Desktop.
Fake detect double click in OpenHAB
// source https://groups.google.com/d/msg/openhab/TnIqLpjIfZo/KFIcvgpxwL4J
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
var DateTime lastClickWallSwitch = new DateTime()
rule "Wall Switch Count Double Click"
when
Item Wall_Switch_Count_Switch received update
then
if (now.isBefore(lastClickWallSwitch.plusSeconds(1))) {
logInfo("DoubleClick", "lastClickWallSwitch double click detected")
} else {
logInfo("DoubleClick", "lastClickWallSwitch single click detected")
}
lastClickWallSwitch = new DateTime()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment