Page 1 of 1

Using variables as part of pre-defined device commands

Posted: Wed Feb 05, 2014 4:10 am
by cv27
I have a device defined that contains 30 different commands. I would like to replace, for example, a hard coded address present in all 30 commands with a variable. Ex:

POST /cgi-bin/toServerValue.cgi HTTP/1.1\x0D\x0AContent-Length: 14\x0D\x0AContent-Type: text/plain; charset=ISO-8859-1\x0D\x0AHost: 192.168.1.17:3388\x0D\x0AConnection: Keep-Alive\x0D\x0A\x0D\x0A{"remote":"w"}

So, could I replace that address with a variable such as:

POST /cgi-bin/toServerValue.cgi HTTP/1.1\x0D\x0AContent-Length: 14\x0D\x0AContent-Type: text/plain; charset=ISO-8859-1\x0D\x0AHost: [IP-address]:3388\x0D\x0AConnection: Keep-Alive\x0D\x0A\x0D\x0A{"remote":"w"}

??

Re: Using variables as part of pre-defined device commands

Posted: Wed Feb 05, 2014 7:35 am
by DemoPad
That is exactly how you would do it, with square brackets. If you create a label called "MyLabel" and use [MyLabel] anywhere in a command, the value of the label will be replaced before the command is sent.