Hi guys . i’m new on the openhab and i have some problems.i want to automate my lights but at a button press i wanna change light state ( ON-Off and reverse) :)) . i wrote the code but is not working .
this is my items tab :
//Relays
Switch channela “Bec Interior” { gpio=“pin:26 activelow:yes initialValue:high” }
Switch channel2 “Bec Exterior” { gpio=“pin:19 activelow:yes initialValue:high” }
Switch channel3 “Channel 3” { gpio=“pin:13 activelow:yes initialValue:high”}
Switch channel4 “Channel 4” { gpio=“pin:6 activelow:yes initialValue:high”}
Contact DoorSensor “Door Sensor [%s]” { gpio=“pin:16 debounce:10 activelow:yes” }
Contact contact_interior { gpio=“pin:24 debounce:30 activelow:yes” }
and this is my rules tab:
rule “Update light when button pressed”
when
Item contact_interior changed from OPEN to CLOSED
then
if(channela.state == ON){sendCommand(channela,OFF)
//LogInfo(“interior”,“Switching to OFF”)
}
else{ sendCommand(channela,OFF)
//LogInfo(“interior”,“Switching to OFF”)
}
end
and this is my sitemap tab:
sitemap home label=“Andy’s House”
{
Switch item=channela
Switch item=channel2
Switch item=channel3
Switch item=channel4
Text item=contact_interior
Text item=DoorSensor
idk what i’m doing wrong . when the button is pressed . nothing happens