Last active
October 20, 2015 08:50
-
-
Save digiltd/17c3bf4aacbfad3278c2 to your computer and use it in GitHub Desktop.
Fake detect double click in OpenHAB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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