Skip to content

Configuration

Ellis Percival edited this page Jun 20, 2020 · 5 revisions

Configuration is stored in a YAML file which is passed as an argument to the server on startup. It consists of various sections, which configure aspects of the software itself, and of the hardware your device is connected to.

An example of a configuration file for a Raspberry Pi using its onboard GPIO output pins to control a set of lights and a fan, while listening on an input for a doorbell button:

mqtt:
  host: test.mosquitto.org
  port: 1883
  user: ""
  password: ""
  topic_prefix: home/kitchen

gpio_modules:
  - name: raspberrypi
    module: raspberrypi

digital_outputs:
  - name: lights
    module: raspberrypi
    pin: 21
    on_payload: "ON"
    off_payload: "OFF"
    initial: low  # This optional value controls the initial state of the pin before receipt of any messages from MQTT. Valid options are 'low' and 'high'.
    retain: yes # This option value controls if the message is retained. Default is no.

  - name: fan
    module: raspberrypi
    pin: 22
    inverted: yes  # This pin may control an open-collector output which is "on" when the output is "low".
    on_payload: "ON"
    off_payload: "OFF"

digital_inputs:
  - name: doorbell
    module: raspberrypi
    pin: 23
    on_payload: "ON"
    off_payload: "OFF"
    pullup: yes
    pulldown: no
Clone this wiki locally