The virtual HTTP inputs allows you to readout a value from a website or a XML-File. This feature makes it possible to implement data inquiry of a device with web interface without PicoC.
Fields of application: heating control, PV-inverter, multimedia uses, etc.
CREATE VIRTUAL HTTP INPUT
In the periphery window click on virtual inputs and then select virtual HTTP input.
In the Properties window of the virtual HTTP input, the protocol, address and port of the device to be controlled can be entered. Furthermore, you can set the polling cycle.
In this example a value from a website gets periodically read out. To keep it simple we use the state of a Miniserver input in this example. However, it works in a similar manner with other devices.
If authentication is needed, you can add username and password to the string as follows: We only support the Basic Authentication Scheme.
In this example we connect to the IP 10.44.44.40 with user “admin” and password “admin”.
/dev/sps/io/Test/state is the webservice-command to get the value of input “Test” on the Miniserver.
VIRTUAL HTTP COMMAND
So far the website will be reloaded every 10 seconds. To get a value, we need a virtual command.
Highlight the recently created virtual HTTP input in the periphery window and then select virtual HTTP input command.
Now we take a look on the website we would like to analyse.
For that reason we simply open the page in our browser.
As shown in the screenshot, there is the keyword value=” in front of the value we would like to get:
This is significant for the command recognition.
Our setting: value=”\v
That means: take the value (\v), after value=”
A common mistake is to use \1 instead of \v. On websites, numbers are often displayed as single ASCI signs. If you interpret the sign as ASCI it will be the value it shows plus 38. For example the digit 3 has the ASCI value 41.
Back to the example:
Every 10 seconds we will receive the value of input Test on the Miniserver with the IP 10.44.44.30.
Just a brief overview which commands and control signs are available:
|\v||Using the variable \v, the virtual HTTP input can take on the value given by the sender|
|\1||Byte 1 (lowest significant bit)|
|\4||Byte 4 (most significant bit)|
|\h||Using the variable \h, the virtual HTTP input can take on the hex value given by the sender|
|\x||hexadecimal such as \x09 for 0x09|
|\b||tab (0x09) or blank (0x20)|
|\r||Carriage Return (0x0D)|
|\n||Line Feed (0x0A)|
|\d||any digit (0-9)|
|\m||any alphabetic< character (A-Z,a-z) or digit (0-9)|
|\a||anyalphabetic character (A-Z,a-z)|
|\s12||skip 12 characters (\s17 = skip 17 characters)|
|\ixxx\i||jump to xxx such as \ivalue\i jumps after value|
It is possible to use and combine multiple control signs in one command.