GPIO
The GPIO module provides access to the GPIO pins of single board computers. See below for a list of supported boards that this module can be used with.
Permissions
A udev
rule file is provided to simplify access permissions for GPIO pins.
First add the gpio
group if it does not exist, then add the user running
MQTTany to the gpio
group:
sudo addgroup --system gpio
sudo usermod -aG gpio mqttany
Then install the udev
rule and reboot:
sudo cp udev/98-gpio.rules /etc/udev/rules.d/
sudo reboot now
Paths
All pins configured in this module are available as properties of the node gpio
.
The state of a pin is available on the path gpio/{pin-id}
.
Path |
Description |
---|---|
|
The polling interval will be published
here when the module starts, with
|
|
Sending any message (even blank) here will poll all configured pins and publish their states to their respective topics. |
|
Pin state will be published here. |
Configuration
Optional settings are commented out with default values shown.
gpio:
#mode: 'SOC'
#polling interval: 60
pin-id:
pin:
#name: '{pin_id}'
#pin mode: 'input'
#resistor: 'off'
batch-id:
pin: [ ]
#name: '{pin_id}'
#name: [ ] # can also provide a matching list of names
#first index: 0
#pin mode: 'input'
#resistor: 'off'
Module Settings
Option |
Description |
---|---|
|
GPIO numbering scheme, can be Optional, default |
|
Interval in seconds to publish all pin states. Optional, default |
Single Pin Definition
Pin configuration section names must be unique as they are used as property IDs.
Property IDs can only contain lowercase letters a-z
, numbers 0-9
, and
hyphens -
. The following settings are for single GPIO pin definitions:
Option |
Description |
---|---|
|
Friendly name for the pin. Substitutions:
Optional, default |
|
GPIO pin number. |
|
Pin mode, see available pins for options. Optional, default |
|
Pin pull resistor for inputs, can be Optional, default |
Multiple Pin Definition
It is also possible to define settings for several GPIO pins at the same time. Settings from single pin definitions apply here also, except those shown below.
Option |
Description |
---|---|
|
Instead of a single GPIO pin number you can specify a list of pins. |
|
For multiple pin definitions, name can be a single name or a list of names the same length as the list of pins. An additional substitution If a single name is given and the substitution Optional, default |
|
Will be added to pin number’s index in the list of
pins when subsituting Optional, default |
Supported Boards
All up to 4B should work, but not all have been tested.
Odroid C1 (untested)
Odroid C1+ (untested)
Odroid XU3 (untested)
Odroid XU4 (untested)
Odroid N2 (untested)