Documentation

Relay Configuration

Configure relays to control high-power devices using the Raspberry Pi's low-voltage GPIO.

Overview

Relays are a great way to control high-power devices using the Raspberry Pi's low-voltage GPIO. MudPi lets you add relays and control them by publishing events over Redis to the channel the relay is listening on.

Relays can be configured for both the main MudPi controller and nodes. However, it is recommended to use relays on the main controller for system reliability.

JSON
{
  "relays": [
    {
      "name": "Relay 1",
      "pin": 27,
      "normally_open": true,
      "group": "group1",
      "topic": "garden/pi/relays/1",
      "key": "relay_1"
    }
  ]
}

Settings

Option Type Required Description
`pin` Integer Yes GPIO pin on the Raspberry Pi the relay is connected to.
`key` String Yes Unique slug to identify the relay. Also used as the Redis key with `_state` appended (e.g. `relay_1_state`).
`name` String No Friendly display name of the relay.
`normally_open` Boolean No Whether the relay is normally open or normally closed. Default: `false`.
`group` String No Assign the relay to a group to control multiple relays at once.
`topic` String No Channel the relay listens on for commands. If relays share a channel, they will both trigger. Default: `mudpi/relays/[relay_key]`.
`restore_last_known_state` Boolean No When the system crashes, enables relays to restore their last saved state from Redis. Default: `false`.

Warning

If relays share a topic channel, they will both trigger when a command is sent. Use unique topics to control relays independently.

Learn more about relays and how to trigger them in the Toggles documentation.