Use item state (value) in URL sendHttpGetRequest

I want to send an item value to a dummy device on a nodemcu with espeasy firmware. To achieve this I’m trying to write a rule that send the actual item value whenever it changes. The only obstacle I’m still facing is that I cannot seem to figure out how to enter the float value inside the URL construction.

This is my first try. (not working). The last parameter is the one that I need to send.

http://192.168.1.32/control?cmd=taskvalueset,devicenumber,valuenumber,value

http://192.168.1.32/control?cmd=taskvalueset,4,1,163 where 163 is my item value.

rule "send-mqtt-to-espeasy"
when
Item Yield_DayTotal changes
then
sendHttpGetRequest("http://192.168.1.32/control?cmd=taskvalueset,4,1,"Yield_DayTotal.state as DecimalType"")
end
val myUrlstring = "http://192.168.1.32/control?someparam=" + Yield_DayTotal.state.toString + " rest of url"
sendHttpGetRequest(myUrlstring)
1 Like

@rossko57 thank for your quick reply. However, my value needs to be at the end of the URL string. How would one solve this? I’m not succeeding in finding the right syntax :frowning:

Crikey, it’s just string concatenation.

SomeString = partA + partB + partC

Want a different order?
SomeString = partA + partC + partB
Want less parts?
SomeString = partX + partY
Some parts are literals, some variables or Item states?
SomeString = variableFred + " banana " + myItem.state.toString

Just make all chunks strings.