My working rule:
rule "Update kitchen light when button pressed"
when
Item Contact_LivingRoom1 changed from OPEN to CLOSED
then
if(Light_Kitchen.state == ON){
sendCommand(Light_Kitchen,OFF)
//LogInfo("Kitchen", "Switching to OFF")
}
else {
sendCommand(Light_Kitchen,ON)
//LogInfo("Kitchen", "Switching to ON")
}
end
rule "Update bathroom light when button pressed"
when
Item Contact_Bathroom changed from OPEN to CLOSED
then
if(Light_Bathroom.state == ON){
sendCommand(Light_Bathroom,OFF)
//LogInfo("Kitchen", "Switching to OFF")
}
else {
sendCommand(Light_Bathroom,ON)
//LogInfo("Kitchen", "Switching to ON")
}
end
rule "Update living room light when button pressed"
when
Item Contact_LivingRoom2 changed from OPEN to CLOSED
then
//and Light_Module2.state == ON and Light_Module3.state == ON and Light_Module4.state == ON
if(Light_Module1.state == ON ) {
sendCommand(Light_Module1, OFF)
sendCommand(Light_Module2, OFF)
sendCommand(Light_Module3, OFF)
sendCommand(Light_Module4, OFF)
sendCommand(Light_Hallway, OFF)
//LogInfo("LivingRoom", "Switching to OFF")
}
else {
sendCommand(Light_Module1, ON)
sendCommand(Light_Module2, ON)
sendCommand(Light_Module3, ON)
sendCommand(Light_Module4, ON)
sendCommand(Light_Hallway, ON)
//LogInfo("Kitchen", "Switching to ON")
}
end
My working items:
/* Lights */
Switch Light_Balcony "Outlet" (Group_Balcony) { gpio="pin:10" } //relay 3
Switch Light_Module1 "Module 1" (GF_Living,Lights) { gpio="pin:12" } //Relay 16
Switch Light_Module2 "Module 2" (GF_Living,Lights) { gpio="pin:19" }
Switch Light_Module3 "Module 3" (GF_Living,Lights) { gpio="pin:16" } //Relay 14
Switch Light_Module4 "Module 4" (GF_Living,Lights) { gpio="pin:26" }
//Switch Light_GF_Elefant "Elefant" (GF_Living,Lights) { gpio="pin:6" }
//Switch Light_GF_Glass "Glass" (GF_Living,Lights) { gpio="pin:13" }
//Switch Light_GF_WallWasher "Wall washer" (GF_Living,Lights) { gpio="pin:10" }
/*Bathroom*/
Switch Light_Bathroom "Ceiling" (FF_Bath,Lights) { gpio="pin:9" }
/*Kitchen*/
Switch Light_Kitchen "Ceiling" (Group_Kitchen,Lights) { gpio="pin:6" } //Relay 4
/*Group_Hallway*/
Switch Light_Hallway "Ceiling" (Group_Hallway,Lights) { gpio="pin:20" } //Relay 12
Switch Light_DoorOpener "Door Opener" <heating> (Group_Hallway,Lights) { gpio="pin:22" } //Relay 5
Switch Heating_Hallway "Hallway Heating" <heating> (Group_Hallway, Heating) { gpio="pin:17" } //Relay 9
/* Heating */
Switch Heating_GF_Living "Livingroom" <heating> (GF_Living, Heating) { gpio="pin:27" }
Switch Heating_GF_Kitchen "Kitchen" <heating> (GF_Kitchen, Heating) { gpio="pin:11" }
Switch Heating_FF_Bath "Bath" <heating> (FF_Bath, Heating) { gpio="pin:5" }
Switch Heating_FF_Office "Master bedroom" <heating> (FF_MasterBedroom , Heating) { gpio="pin:21" }
Switch Heating_FF_Bed "Bedroom" <heating> (FF_Bed, Heating) { gpio="pin:4" }
/*Contact*/
Contact Contact_LivingRoom1 {gpio="pin:18 debounce:30 activelow:yes"}
Contact Contact_LivingRoom2 {gpio="pin:23 debounce:30 activelow:yes"}
Contact Contact_Bathroom {gpio="pin:24 debounce:30 activelow:yes"}
Color rgb_strip_living_room "RGB Ledstrip Living Room" (rgb) {dmx="CHANNEL[22,23,24:1000]"}
Thanks guys, sometimes i need to press the bathroom and living room switch several times, no idea why but thats liveable… No I need to get my motion sensor to work, myopenhab and dmx…