![Xytronix Research & Design ControlByWeb WebRelay-10 Скачать руководство пользователя страница 23](http://html1.mh-extra.com/html/xytronix-research-and-design/controlbyweb-webrelay-10/controlbyweb-webrelay-10_user-manual_892345023.webp)
Revision 1.01
WebRelay-10
TM
Users Manual
state.xml?relay1State=2&pulseTime1=5
This will pulse the relay for 5 seconds
state.xml?relay1State=2&pulseTime1=5
This will pulse the relay for 5 seconds
state.xml?relay1State=2
This will pulse the relay for the preset time (1.5 seconds)
(Note that http://192.168.1.2/ would be included on all commands above)
Multiple relays can be changed with a single command by submitting multiple relayXState variables separated by an
ampersand symbol (&). All four relayXState variables or a subset of the relayXState variables can be included. The
relayXState variables can be in any order. Relays that are already in the desired state will not be affected by on/off
commands. Note that pulse commands will reset the pulse timer each time a command is received.
The following line illustrates how to turn ‘on’ relay 1, turn ‘on’ relay 2, and turn ‘off’ relay 10.
http://192.168.1.2/state.xml?relay1State=1&relay10State=0&relay2State=1
When the above commands are sent to WebRelay-10
TM
, its current state is returned in the form of an XML page. The
commands can also be sent without having WebRelay-10
M
return the XML page. This is accomplished by adding the
noReply field as follows.
Turn relay3 ‘on’ without returning state: http://192.168.1.2/state.xml?relay3State=1&noReply=1
Turn relay3 ‘off’ without returning state: http://192.168.1.2/state.xml?relay3State=0&noReply=1
Password :
If the control password is enabled in the WebRelay-10
TM
unit and the XML page is requested through a browser, the
browser will prompt the user for the password. If the XML request is sent from another application and not a
browser, the html request will need to contain the password encoded using the base 64 encoding scheme. The html
request header without the password looks like this:
GET /state.xml?noReply=1 HTTP/1.1 (Ends with two \r\n)
The html request header with the password looks like this:
GET /state.xml?relay2State=1&noReply=1 HTTP/1.1 (Ends with two \r\n)
Authorization: Basic bm9uZTp3ZWJyZWxheQ== (Ends with two \r\n)
where bm9uZTp3ZWJyZWxheQ== is the base 64 encoded version of the username and password
none:webrelay
A utility is provided at http://www.ControlByWeb.com/encoder that can be used to encode the password. The utility
is used by simply typing the string username:password into the website and pressing encode.
3.3 Modbus Operation
WebRelay-10
TM
can be controlled (and read) using Modbus/TCP protocol. This provides a standard means of using
WebRelay-10
TM
in conjunction with devices and software from other manufacturers. This section contains the
information necessary to communicate with WebRelay-10
TM
using Modbus/TCP. This is not a tutorial on Modbus
and it is assumed that reader is already familiar with Modbus. Detailed Modbus information can be found at
http://www.modbus.org.
It is important to note that when the control password in WebRelay-10
TM
is enabled, Modbus/TCP communications
are disabled. This is because Modbus/TCP does not provide a mechanism for password protection. Make sure the
control password is disabled (default) before using Modbus with WebRelay-10
TM
.
WebRelay-10
TM
functions as a Modbus server. Client devices open a connection with WebRelay-10
TM
on port 502
(unless another modbus port is selected) and sends commands or requests to read the state of a relay, or change a
relay. When WebRelay-10
TM
receives a command, it will perform the desired function and return a response. The
Xytronix Research & Design, Inc.
page 23