4-channel relay relay4.1
A board whose four relays turn on and off one by one or all together.
Use
For devices with four separate outputs, such as an ESP-12F 4-channel relay board.
On the device
On connecting, the device announces this type with t= in @$ui and sends @$state whenever its state changes. Apps send commands to <cid>@.
@$name My 4-channel relay:Living room
@$ui t=relay4.1
@$state r1=1;r2=1;r3=1;r4=1
State keys @$state
| Key | Values | Meaning |
|---|---|---|
r1 | 0 / 1 | Relay 1: 1 when on, 0 when off |
r2 | 0 / 1 | Relay 2 |
r3 | 0 / 1 | Relay 3 |
r4 | 0 / 1 | Relay 4 |
Commands <cid>@
| Command | Meaning |
|---|---|
r1=1 | Turn relay 1 on |
r1=0 | Turn relay 1 off |
r2=1 | Turn relay 2 on |
r2=0 | Turn relay 2 off |
r3=1 | Turn relay 3 on |
r3=0 | Turn relay 3 off |
r4=1 | Turn relay 4 on |
r4=0 | Turn relay 4 off |
all=1 | Turn all four relays on |
all=0 | Turn all four relays off |
{v} is the slider or color value. Even for an unknown command the device should send its current state, so the app does not wait.
Implementation notes
- Always send all four keys together: r1=0;r2=1;r3=0;r4=0
- all=1 and all=0 are rule commands for every device with channel keys (switch2–8 accept them too). Send the state once after handling them.
- Other devices that control this board use the same commands, for example the Remocon8266 button controller (Remocon8266-button-controller).
Default picture
Without v=1 in $ui and a $view, apps use this picture. Its values name the $state keys the picture reads.
{"kind":"relays","keys":["r1","r2","r3","r4"]}
Examples
- esp8266-relay4ch — example page on arduino.iosignal.net
Type file
iosignal/devices/types/relay4.1.json (rev 2) · CDN
The screen labels in the type file are in Korean; apps show them as written.