Using variables as part of pre-defined device commands

Forum to ask for any help
Post Reply
cv27
Posts: 233
Joined: Sat Nov 24, 2012 10:15 pm
Location: Montréal, QC, Canada

Using variables as part of pre-defined device commands

Post by cv27 » Wed Feb 05, 2014 4:10 am

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"}

??

User avatar
DemoPad
Site Admin
Posts: 770
Joined: Thu Jun 14, 2012 10:46 am
Contact:

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

Post by DemoPad » Wed Feb 05, 2014 7:35 am

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.

Post Reply