Skip to content

Instantly share code, notes, and snippets.

@maxistar
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save maxistar/8fdd6989560c3a1c7df7 to your computer and use it in GitHub Desktop.

Select an option

Save maxistar/8fdd6989560c3a1c7df7 to your computer and use it in GitHub Desktop.
Configuration for serial binding
//add to the beginning of file:
var String ArduinoUpdate = ""
rule "Arduino on update"
when
Item Arduino received update
then
ArduinoUpdate = ArduinoUpdate + Arduino.state.toString.trim
println("ArduinoUpdate: " + ArduinoUpdate)
if (ArduinoUpdate.contains(";")) {
if (ArduinoUpdate.contains("item=Light_GF_Living_Ceiling_1")) {
postUpdate(Light_GF_Living_Ceiling_1, if(ArduinoUpdate.contains("value=ON")) ON else OFF)
}
ArduinoUpdate = ""
}
end
rule "Arduino LED red"
when
Item Light_GF_Living_Ceiling_1 received update
then
sendCommand(Arduino, "set led red " + (if(Light_GF_Living_Ceiling_1.state==ON) "on;" else "off;")))
ArduinoUpdate = ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment