-
1Step 1
OpenHAB items:
Switch Lamp_Switch "Lamp" String Lamp_Red "Lamp Red" String Lamp_Green "Lamp Green" String Lamp_Blue "Lamp Blue" String Lamp_Brightness "Lamp Brightness"
OpenHAB Rules
rule "Turn Lamp off" when Item Lamp_Switch received command OFF then sendHttpGetRequest("http://10.1.1.83/lamp/OFF") end rule "Turn Lamp on" when Item Lamp_Switch received command ON then sendHttpGetRequest("http://10.1.1.83/lamp/ON") end rule "Change lamp brightness" when Item Lamp_Brightness received command then sendHttpGetRequest("http://10.1.1.83/lamp/brightness/" + receivedCommand) postUpdate(Lamp_Brightness, "") end rule "Change lamp red level" when Item Lamp_Red received command then sendHttpGetRequest("http://10.1.1.83/lamp/red/" + receivedCommand) postUpdate(Lamp_Red, "") end rule "Change lamp green level" when Item Lamp_Green received command then sendHttpGetRequest("http://10.1.1.83/lamp/green/" + receivedCommand) postUpdate(Lamp_Green, "") end rule "Change lamp blue level" when Item Lamp_Blue received command then sendHttpGetRequest("http://10.1.1.83/lamp/blue/" + receivedCommand) postUpdate(Lamp_Blue, "") end
OpenHAB Sitemap
sitemap lamp label="Lamp" { Frame label="Lamp controls" icon="lamp" { Switch item=Lamp_Switch Switch item=Lamp_Brightness mappings=["DOWN"='-', "UP"='+'] Switch item=Lamp_Red mappings=["DOWN"='-', "UP"='+'] Switch item=Lamp_Green mappings=["DOWN"='-', "UP"='+'] Switch item=Lamp_Blue mappings=["DOWN"='-', "UP"='+'] } }
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.