Support Forums
http send command

Hello every one

I am new to VTScada
Successfully used json/xml driver to read the data from external Device
But i am stuck in how to send data ?
For example i want to send http command when button is pressed !
Any ideas ?

Hello every one I am new to VTScada Successfully used json/xml driver to read the data from external Device But i am stuck in how to send data ? For example i want to send http command when button is pressed ! Any ideas ?

Currently, the JSON/XML driver is only capable of receiving data. VTScada does have the capability to do this however, it would take some experience and custom coding to implement.

Currently, the JSON/XML driver is only capable of receiving data. VTScada does have the capability to do this however, it would take some experience and custom coding to implement.

Trihedral Engineering Ltd.

sad to hear that
we like VTScada, but why making json/xml driver in only one way ?

sad to hear that we like VTScada, but why making json/xml driver in only one way ?

Did you figure out how to send an http command? I too have figured out how to poll a device using xml, but haven't figure out how to write to the device. Please let me know if you have made any headway in sending http commands.
Thank you

Did you figure out how to send an http command? I too have figured out how to poll a device using xml, but haven't figure out how to write to the device. Please let me know if you have made any headway in sending http commands. Thank you

There is likely another option. Could you please say more about what you are trying to achieve? Submitting form data to the server, which then runs a cgi script?

There is likely another option. Could you please say more about what you are trying to achieve? Submitting form data to the server, which then runs a cgi script?

Andrew,
Thanks for responding.

This is my scenario, I have a device that is connecting to a remote proxy server via a cellular connection. I was able create a tag that reads the .xml file from the device through the proxy server. I also need to be able to send commands to the device to turn on or off relays, etc...I can type out a url in browser such as this (http://192.168.148.135:34656/000CC804F1CD/state.xml?relay1state=1) which will turn on the relay. I also found today that I can use the curl command at a command prompt to do the same thing.

I would like to be able to click a button that would issue the above url to activate the relay.

Thank you

Andrew, Thanks for responding. This is my scenario, I have a device that is connecting to a remote proxy server via a cellular connection. I was able create a tag that reads the .xml file from the device through the proxy server. I also need to be able to send commands to the device to turn on or off relays, etc...I can type out a url in browser such as this (http://192.168.148.135:34656/000CC804F1CD/state.xml?relay1state=1) which will turn on the relay. I also found today that I can use the curl command at a command prompt to do the same thing. I would like to be able to click a button that would issue the above url to activate the relay. Thank you

Hopefully VTScada new version will come with send http commands driver

Hopefully VTScada new version will come with send http commands driver

If you have cURL installed, you can just write a short *.bat file to post your http request. The batch file can be run using the program spawn button widget.

If you have cURL installed, you can just write a short *.bat file to post your http request. The batch file can be run using the program spawn button widget.

Trihedral Engineering Ltd.

Just a question of using the right tool for the job. The command you want is Spawn, and you'll need to delve into code to do this.

(The following contains a few ideas that might be very bad. Use with caution. More warnings at the end.)

To start, refer to https://www.trihedral.com/help/Content/Pro_Functions/Spawn.htm
You'll want to copy the last code example. (Sorry about the formatting error - will fix the .css for the next release.)

Open your page in the Idea Studio, and in the home ribbon click the Source Code tool. As soon as the source code opens in your default editor, close the Idea Studio. You do not want to edit the same page in two places at once.

Paste the example from the documents into the top of the Main state. Save the file, and use the tool in the VAM to Import File Changes. Try the button.

Assuming that worked, the next step is to change the URL to call your device and send a value to the relay1state. Most of that is just cut and replace, but what if you want to write a 1 or 0 depending on whatever?

Create an Analog Control tag (no driver, no address, make the scales match so that 1 doesn't get turned into 40.95). Draw it as a Numeric Entry. Close the Idea Studio to force a write to file.
Re-open the page's source code in your editor. At the very end of the state, there will be a GUITransform, in which you'll spot the word "NumericDataEntry". The bit just before that is the link to your Analog Status tag.
Copy the text Scope(\VTSDB, "xxxxx", TRUE)
Scroll back up to the beginning of your page.
In the Variables section, declare a new variable right below Color. Maybe call it Parm1;

Back into the Main state, add code to watch the Analog Status tag and set Parm1 when that changes:
IF Watch(Scope(\VTSDB, "xxxxx", TRUE)\Value);
[
Parm1 = Scope(\VTSDB, "xxxxx", TRUE)\Value;
]

Okay, now all you need to do is use a Concat in the variable you pass to the widget, ProgramSpawn and you're there. Don't forget to import file changes.

Now the warnings:
1) VTScada code is not GWBasic. You really (and I mean really) need to read through the first few chapters of the Programmer's Guide in order to understand what's going on, and avoid trouble.

2) Are you certain that you want to have a device that accepts unauthenticated commands over the Internet? How are you securing that? The steps I described don't allow for a process of authentication and encryption. That could be very, very bad. Don't assume that any url is too obscure to be found.

3) My steps left out details on purpose. (Like, where's that Import File Changes tool, and how do you use a Concat?) That's to "encourage" you to read the Programmer's Guide rather than just follow a script.

4) If you're only writing a 1 or 0, you might want to use a two-position Selector Switch instead of an Analog Status.

Just a question of using the right tool for the job. The command you want is Spawn, and you'll need to delve into code to do this. (The following contains a few ideas that might be very bad. Use with caution. More warnings at the end.) To start, refer to https://www.trihedral.com/help/Content/Pro_Functions/Spawn.htm You'll want to copy the last code example. (Sorry about the formatting error - will fix the .css for the next release.) Open your page in the Idea Studio, and in the home ribbon click the Source Code tool. As soon as the source code opens in your default editor, close the Idea Studio. You do not want to edit the same page in two places at once. Paste the example from the documents into the top of the Main state. Save the file, and use the tool in the VAM to Import File Changes. Try the button. Assuming that worked, the next step is to change the URL to call your device and send a value to the relay1state. Most of that is just cut and replace, but what if you want to write a 1 or 0 depending on whatever? Create an Analog Control tag (no driver, no address, make the scales match so that 1 doesn't get turned into 40.95). Draw it as a Numeric Entry. Close the Idea Studio to force a write to file. Re-open the page's source code in your editor. At the very end of the state, there will be a GUITransform, in which you'll spot the word "NumericDataEntry". The bit just before that is the link to your Analog Status tag. Copy the text Scope(\VTSDB, "xxxxx", TRUE) Scroll back up to the beginning of your page. In the Variables section, declare a new variable right below Color. Maybe call it Parm1; Back into the Main state, add code to watch the Analog Status tag and set Parm1 when that changes: IF Watch(Scope(\VTSDB, "xxxxx", TRUE)\Value); [ Parm1 = Scope(\VTSDB, "xxxxx", TRUE)\Value; ] Okay, now all you need to do is use a Concat in the variable you pass to the widget, ProgramSpawn and you're there. Don't forget to import file changes. Now the warnings: 1) VTScada code is not GWBasic. You really (and I mean *really*) need to read through the first few chapters of the Programmer's Guide in order to understand what's going on, and avoid trouble. 2) Are you certain that you want to have a device that accepts unauthenticated commands over the Internet? How are you securing that? The steps I described don't allow for a process of authentication and encryption. That could be very, very bad. Don't assume that any url is too obscure to be found. 3) My steps left out details on purpose. (Like, where's that Import File Changes tool, and how do you use a Concat?) That's to "encourage" you to read the Programmer's Guide rather than just follow a script. 4) If you're only writing a 1 or 0, you might want to use a two-position Selector Switch instead of an Analog Status.

Thank you so much for the help. I'm digging into the guide now and I'll let you know how it goes.

I do have the ability to secure this communication, I was going to things operational before I added another layer of complexity.

Thank you so much for the help. I'm digging into the guide now and I'll let you know how it goes. I do have the ability to secure this communication, I was going to things operational before I added another layer of complexity.
212
9
5
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft