Relay Configuration

Relays are a great way to control high power devices using our raspberry pis low voltage GPIO. MudPi allows 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 typically on a main controller for system reliability.

Below is an example of a relay configuration.

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


pin[Integer]YesGPIO pin on the raspberry pi the relay is connected to.
key[String]YesA unique slug value that is used to identify the relay. This value with also used as they key with '_state' appended to store relay state in redis. i.e. relay_1_state
name[String]NoFriendly display name of the relay. Useful for UI.
normally_open[Boolean]NoType of relay connection normally open or normally closed. Default False
group[String]NoAssign relay to a group to control multiple relays at once.
topic[String]NoChannel that relay will listen for command on. If relays share a channel they will both trigger when a command is sent! Default 'mudpi/relays/[relay_key]'
restore_last_known_state[Boolean]NoA setting that when the system crashes, it enables relays to look for the last saved state in redis and attempt to restore it. Default False

Learn more about relays and how to trigger them under the relay docs.