Curl with item as parameter in exec command

I try to hand over an item as a parameter to a ON:exec curl item which looks like this:

Switch Abus_Motion_timer_UPD "Update Ignore timer" (G_Abus) { exec=">[ON:curl http://root:xxxx@]"}

If I replace “Abus_Motion_timer_sec” with a number (e.g. 360), the exec command will do it’s job.

Any suggestion?



Unfortunately it didn’t help.
Any other idea? :smile:

By the way, in the rule the variable mentioned above is set by:

Abus_Motion_timer_sec.postUpdate((Abus_Motion_timer.state as DecimalType).intValue * 60)

and shows in the log obviously as a regular int value:

TeleEye Motion Detection timer updated to: 600

Have you tried this?

Switch Abus_Motion_timer_UPD "Update Ignore timer" (G_Abus) { exec=">[ON:curl http://root:xxxx@" + Abus_Motion_timer_sec + "]"}

According to the Exec binding wiki, you only have access to the current item’s current state or command, not a different item’s. But if you used the Abus_Motion_timer_sec item for the exec binding, you could achieve what you’re after:

Number Abus_Motion_timer_sec "your label [%d]" (G_Abus) { exec=">[*:curl http://root:xxxx@$s]" ...optional additional binding configs separated with commas... }

In other words, sending number commands to your Number item will cause the number in the command to be sent to the web server.

I am sorry, but both solutions did not help.
The first syntax (@Mikey) is refused by OH Designer.
The second (@watou) doesn’t throw an error, but the website is not updated.
(no error in the log). :frowning:

Maybe you can get rid of the item and use the executeCommandLine action in you rule. You can then format the string with String::format.

Something like this

var String timersec = ((Abus_Motion_timer.state as DecimalType) * 60).intValue().toString()
var String command = String::format(“curl http://root:xxxx@” + timersec)

Thank you very much!
That did the job!