How to use "dimmerlevel" in a rule?

Hi everyone,

I’m trying to ‘sendHttpGetRequest’ that include the variable “dimmerlevel” in the URL. I have done this with ON/OFF and that works, but I simply can not figure out how to do the same using “dimmerlevel” value. I have tried searching this forum an google but can not find any information.

My simple on/off rule that works:

rule "Turn Garage_Loftlampe on"
when
Item Light_Garage_Loftlampe changed to ON
then
sendHttpGetRequest(“http://192.168.10.11:8080/json.htm?type=command&param=switchlight&idx=20&switchcmd=On”)
end

rule "Turn Garage_Loftlampe off"
when
Item Light_Garage_Loftlampe changed to OFF
then
sendHttpGetRequest(“http://192.168.10.11:8080/json.htm?type=command&param=switchlight&idx=20&switchcmd=Off”)
end

My dimmer rule

rule "Turn Light_Outdoor_Spots2 on - to dimmer level"
when
Item Light_Outdoor_Spots2 received command
then
sendHttpGetRequest(“http://192.168.10.11:8080/json.htm?type=command&param=switchlight&idx=26&switchcmd=Set%20Level&level=Dimmer_Value”)
end

But how do I get the ‘Dimmer_Value’ replaced by the actual value?

I have no experience with coding/scripting so please forgive my likely basic question.

Kind regards,
Søren

Assuming Light_Outdoor_Spots2 is your dimmer Item:

sendHttpGetRequest("http://192.168.10.11:8080/json.htm?type=command&param=switchlight&idx=26&switchcmd=Set%20Level&level=" + Light_Outdoor_Spots2.state.toString)
1 Like

Just what I needed…

Thank you, Rich :slight_smile: