Skip to content

Instantly share code, notes, and snippets.

@miller45
Created November 14, 2019 17:35
Show Gist options
  • Save miller45/474c0dfb7420bec01691bf8a08bce264 to your computer and use it in GitHub Desktop.
Save miller45/474c0dfb7420bec01691bf8a08bce264 to your computer and use it in GitHub Desktop.
RfBridge Funkschalter Beispiel Regeln
// item fuer die RfBridge... hier weiss ich noch nicht wie man das fuer mehrer Schalter machen kann
String RfBridge "RfKey [%s]" {mqtt="<[mosq:tele/sonoff/30/RESULT:state:default]"}
rule "rfSwitch2"
when
Item RfBridge received update
then
if (RfBridge.state == Uninitialized){
logInfo("rf.rules","Item RfBridge still null")
return
}
// dieser Transform muss evtl angepasst werden wenn es nicht mit RfKey endet beispielsweise
val rfKey = transform("JSONPATH","$.RfReceived.RfKey",RfBridge.state.toString)
if (rfKey=="11") {
Bathroom.members.forEach[item | sendCommand(item,OFF)]
Kitchen.members.forEach[item | sendCommand(item,OFF)]
Living.members.forEach[item | sendCommand(item,OFF)]
}
if (rfKey=="12") {
Bathroom.members.forEach[item | sendCommand(item,ON)]
Kitchen.members.forEach[item | sendCommand(item,ON)]
Living.members.forEach[item | sendCommand(item,ON)]
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment