[ENG] 15.2. [DKSF 48.5 IU] The Control of The Relay

The interface of URL-encoded command in the device can be used for the integration with web applications without  the SNMP protocole. The relay control is available via the interface of URL-encoded commands.

Request of the relay state

http://192.168.0.100/relay.cgi?rN

where: 

N — the relay number is indicated after ?r.

Return values

Error (wrong format of the request or wrong relay number):

relay_result('error');

Successful execution of the command

relay_result('ok', 1, 1);

where:

The first argument: always 'ok' (upon request error - 'error')

The second argument: the source of the relay control:

0 — OFF;

1 — ON.

The third argument: the instantaneous current state of the relay (“0” or “1”), considering  the functioning of the “Watchdog” module, activation of a reset, impulse output, etc.

The relay switching


Change of control source, as well as manual switching on and off of the relay:

http://192.168.0.100/relay.cgi?rn=s

After ?r the relay number is indicated, after = the number of mode is indicated (the source of the control).

where:

n — the relay number;

s — the relay operation mode:

0 — Off;

1 — On.

Switching (inverting) the relay, on <-> off:

http://192.168.0.100/relay.cgi?rn=f

The relay should be in the mode «Manual off» or «Manual on».


Short-term switching of the relay to the inverse state (issuing a reset pulse):

http://192.168.0.100/relay.cgi?rn=f,10

Duration in seconds is indicated after the decimal point. Applicable to all modes

Return values

An error is returned if the request format is incorrect as a result of setting an incorrect / invalid value for the relay number or relay mode.

relay_result('ok')

relay_result('error')

Authorization

To add a login and password to the structure of a URL-encoded command, it is possible to use the next scheme:

  • http://<username>:<password>@<host>:<port>/<URL‐path>?<parameters>

where:

<username>:<password> – are credentials for authorization in a device web interface;

<host>  is an IP address of a device;

<port>  is a port of an HTTP server;

<URL‐path>?<parameters>  is a URL-encoded command