Skip to main content

4-channel relay relay4.1

A board whose four relays turn on and off one by one or all together.

← Device types

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​

KeyValuesMeaning
r10 / 1Relay 1: 1 when on, 0 when off
r20 / 1Relay 2
r30 / 1Relay 3
r40 / 1Relay 4

Commands <cid>@​

CommandMeaning
r1=1Turn relay 1 on
r1=0Turn relay 1 off
r2=1Turn relay 2 on
r2=0Turn relay 2 off
r3=1Turn relay 3 on
r3=0Turn relay 3 off
r4=1Turn relay 4 on
r4=0Turn relay 4 off
all=1Turn all four relays on
all=0Turn 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​

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.