Revision 2.6
WebRelay-Quad™
Users Manual
3.2 XML Operation
Custom computer applications may be created to monitor and control WebRelay-Quad™ without
using a web browser. Monitoring the state of the relays is done by sending a GET request to port
80 (or port specified in setup) for the XML page. Control of the relay is done by sending GET
requests to the same page. This can be demonstrated by entering commands into the URL line of
a web browser.
3.2.1 state.xml
Request the current state: http://192.168.1.2/state.xml
This will return the following XML page.:
<?xml version="1.0" encoding="utf-8" ?>
<datavalues>
<relay1state>0</relay1state>
<relay2state>1</relay2state>
<relay3state>1</relay3state>
<relay4state>1</relay4state>
</datavalues>
The tags <relay1state>... <relay4state> indicate the current state of each of the four relays.
Values for the tags are described below.
XML Tags*
Values
<relayXstate>
0 = Off (coil off)
1 = On (coil energized)
* 'X' is replaced by the relay number.
3.2.2 XML Control
Commands can be sent to WebRelay-Quad™ to control the relays. Commands are sent using
variables called relay1State, relay2State, relay3State and relay4State. Examples of using
relayXState (X represents the appropriate relay) are given here.
Note: http://192.168.1.2/ would be included on all of the following commands.
Command
Description
state.xml?relay1State=0
Turn Relay 1 Off
state.xml?relay1State=1
Turn Relay 1 On
state.xml?relay1State=1&relay3State=0
Turn Relay 1 ON, Turn Relay 3 OFF
Commands can be issued to pulse the relays instead of simply turning them on or off by setting
the relayXState to 2. Commands can also specify pulse times so that the relay can be pulsed for
times other than the times specified in the relay setup pages. This is done by sending an
additional variable called pulseTimeX (once again, X represents the appropriate relay).
Command
Description
state.xml?relay1State=2
Pulse Relay 1 for the preset time
state.xml?relay1State=2&pulseTime1=5
Pulse Relay 1 for 5 seconds
state.xml?relay3State=2&pulseTime3=10
Pulse Relay 3 for 10 seconds
Xytronix Research & Design, Inc.
page 29