The software is configured using a single YAML config file. This document details the config options for each section and provides examples for each section.
mqtt
gpio_modules
sensor_modules
stream_modules
digital_inputs
digital_outputs
sensor_inputs
logging
Type: dict
Required: yes
Contains the configuration data used for connecting to an MQTT server.
Example:
mqtt:
host: test.mosquitto.org
port: 8883
topic_prefix: mqtt_io
discovery: yes
tls:
enabled: yes
ca_certs: mosquitto.org.crt
certfile: client.crt
keyfile: client.key
Type: string
Required: yes
Host name or IP address of the MQTT server.
Type: integer
Required: no
Default: 1883
Minimum value: 1
Minimum value: 65535
Port number to connect to on the MQTT server.
Type: string
Required: no
Username to authenticate with on the MQTT server.
Type: string
Required: no
Password to authenticate with on the MQTT server.
Type: string
Required: no
MQTT client ID to use on the MQTT server.
Type: string
Required: no
Prefix to use for all topics.
For example, a
topic_prefix
ofhome/livingroom
would make a digital input called "doorbell" publish its changes to thehome/livingroom/input/doorbell
topic.
Type: boolean
Required: no
Whether or not to start a clean MQTT session on every MQTT connection.
Type: string
Required: no
Default: 3.1.1
Allowed:
- '3.1'
- 3.1.1
Version of the MQTT protocol to use.
This renders in the documentation as a float, but should always be set within quotes.
Type: integer
Required: no
Default: 10
Unit: seconds
Minimum value: 1
How frequently in seconds to send ping packets to the MQTT server.
Type: string
Required: no
Default: status
Topic on which to send messages about the running status of this software.
Sends the payloads configured in
status_payload_running
,status_payload_stopped
andstatus_payload_dead
.
Type: string
Required: no
Default: running
Payload to send on the status topic when the software is running.
Type: string
Required: no
Default: stopped
Payload to send on the status topic when the software has exited cleanly.
Type: string
Required: no
Default: dead
Payload to send on the status topic when the software has exited unexpectedly.
Uses MQTT Last Will and Testament to make the server automatically send this payload if our connection fails.
Type: boolean
Required: no
Enable Home Assistant MQTT discovery of our configured devices.
Type: string
Required: no
Default: homeassistant
Prefix for the Home Assistant MQTT discovery topic.
Type: string
Required: no
Default: MQTT IO
Name to identify this "device" in Home Assistant.
Type: string
Required: no
Default: mqtt_io.mqtt.asyncio_mqtt
MQTT Client implementation module path.
There's currently only one implementation, which uses the asyncio-mqtt client.
Type: dict
Required: no
TLS/SSL settings for connecting to the MQTT server over an encrypted connection.
Example:
mqtt:
host: localhost
tls:
enabled: yes
ca_certs: mosquitto.org.crt
certfile: client.crt
keyfile: client.key
Type: boolean
Required: yes
Enable a secure connection to the MQTT server.
Most of these options map directly to the
tls_set()
arguments on the Paho MQTT client.
Type: string
Required: no
Path to the Certificate Authority certificate files that are to be treated as trusted by this client. More info
Type: string
Required: no
Path to the PEM encoded client certificate. More info
Type: string
Required: no
Path to the PEM encoded client private key. More info
Type: string
Required: no
Default: CERT_REQUIRED
Allowed:
- CERT_NONE
- CERT_OPTIONAL
- CERT_REQUIRED
Defines the certificate requirements that the client imposes on the MQTT server. More info
By default this is
CERT_REQUIRED
, which means that the broker must provide a certificate.
Type: string
Required: no
Specifies the version of the SSL/TLS protocol to be used. More info
By default the highest TLS version is detected.
Type: string
Required: no
Which encryption ciphers are allowable for this connection. More info
Type: boolean
Required: no
Configure verification of the server hostname in the server certificate. More info
If set to true, it is impossible to guarantee that the host you are connecting to is not impersonating your server. This can be useful in initial server testing, but makes it possible for a malicious third party to impersonate your server through DNS spoofing, for example. Do not use this function in a real system. Setting value to true means there is no point using encryption.
Type: list
Required: no
List of GPIO modules to configure for use with inputs and/or outputs.
Each of the entries in this list should be a dict using the following variables.
Some modules require extra config entries, specified by the modules themselves. Until the documentation is written for the individual modules, please refer to the
CONFIG_SCHEMA
value of the module's code in the repository. TODO: Link this to the pending wiki pages on each module's requirements.
Example:
gpio_modules:
- name: rpi_gpio
module: raspberrypi
- name: pcf
module: pcf8574
i2c_bus_num: 1
chip_addr: 0x20
Type: string
Required: yes
Your name for this configuration of the module. Will be referred to by entries
in the digital_inputs
and/or digital_outputs
sections.
Type: string
Required: yes
Name of the module in the code. This is listed in the README's "Supported Hardware" section in brackets.
Type: boolean
Required: no
Default: true
Whether to run the module's cleanup()
method on exit.
Type: list
Required: no
List of sensor modules to configure for use with sensor inputs.
Each of the entries in this list should be a dict using the following variables.
Some modules require extra config entries, specified by the modules themselves. Until the documentation is written for the individual modules, please refer to the
CONFIG_SCHEMA
value of the module's code in the repository. TODO: Link this to the pending wiki pages on each module's requirements.
Example:
sensor_modules:
- name: dht
module: dht22
type: AM2302
pin: 4
- name: ds
module: ds18b
type: DS18S20
address: 000803702e49
Type: string
Required: yes
Your name for this configuration of the module. Will be referred to by entries
in the sensor_inputs
section.
Type: string
Required: yes
Name of the module in the code. This is listed in the README's "Supported Hardware" section in brackets.
Type: boolean
Required: no
Default: true
Whether to run the module's cleanup()
method on exit.
Type: list
Required: no
List of stream modules to configure.
Each of the entries in this list should be a dict using the following variables.
Some modules require extra config entries, specified by the modules themselves. Until the documentation is written for the individual modules, please refer to the
CONFIG_SCHEMA
value of the module's code in the repository. TODO: Link this to the pending wiki pages on each module's requirements.
Example:
stream_modules:
- name: network_switch
module: serial
device: /dev/ttyUSB1
baud: 115200
interval: 10
- name: ups
module: serial
type: /dev/ttyUSB0
baud: 9600
interval: 1
Type: string
Required: yes
Your name for this configuration of the module. Will be used in the topic on which the stream's data is published and the topic on which messages can be sent for writing to the stream.
Type: string
Required: yes
Name of the module in the code. This is listed in the README's "Supported Hardware" section in brackets.
Type: boolean
Required: no
Default: true
Whether to run the module's cleanup()
method on exit.
Type: boolean
Required: no
Whether to set the retain
flag on MQTT messages publishing data received
from the stream.
Type: float
Required: no
Default: 60
Unit: seconds
Minimum value: 0.01
How long to wait between polling the stream for new data.
Type: boolean
Required: no
Default: true
Whether to poll this stream for incoming data and publish it on an MQTT topic.
Type: boolean
Required: no
Default: true
Whether to subscribe to MQTT messages on a topic and write messages received on it to the stream.
Type: list
Required: no
Type: string
Required: yes
Type: string
Required: yes
Type: ['string', 'integer']
Required: yes
Type: string
Required: no
Default: 'ON'
Type: string
Required: no
Default: 'OFF'
Type: boolean
Required: no
Type: string
Required: no
Default: INT
Type: boolean
Required: no
Type: boolean
Required: no
Type: string
Required: no
Allowed:
- rising
- falling
- both
Type: list
Required: no
Type: integer
Required: no
Default: 100
Minimum value: 1
Type: boolean
Required: no
Type: float
Required: no
Default: 0.1
Type: boolean
Required: no
Default: true
Type: dict
Required: no
Type: string
Required: no
Default: binary_sensor
Type: list
Required: no
Type: string
Required: yes
Type: string
Required: yes
Type: ['string', 'integer']
Required: yes
Type: string
Required: no
Default: 'ON'
Type: string
Required: no
Default: 'OFF'
Type: boolean
Required: no
Type: integer
Required: no
Type: string
Required: no
Allowed:
- high
- low
Type: boolean
Required: no
Type: boolean
Required: no
Type: dict
Required: no
Type: string
Required: no
Default: switch
Type: list
Required: no
Type: string
Required: yes
Type: string
Required: yes
Type: boolean
Required: no
Type: integer
Required: no
Default: 60
Minimum value: 1
Type: integer
Required: no
Default: 2
Type: string
Required: no
Type: integer
Required: no
Minimum value: 1
Type: dict
Required: no
Type: string
Required: no
Default: sensor
Type: dict
Required: no
Default:
formatters:
default:
datefmt: '%Y-%m-%d %H:%M:%S'
format: '%(asctime)s %(name)s [%(levelname)s] %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: default
level: INFO
loggers:
mqtt_io:
handlers:
- console
level: INFO
propagate: true
version: 1