MCP230xx
This device class supports the MCP23008 and MCP23017 I/O expander chips.
Paths
All pins configured in this module are available as properties of the device node.
The value of a pin is available on the path {device id}/{pin id}
and, for pins that
accept them, commands can be sent to {device id}/{pin id}/set
. Values for pin states
are ON
or OFF
.
Path |
Description |
---|---|
|
Sending any message (even blank) here will poll all configured pins and publish their states to their respective topics. |
|
If you need more precise timing, this allows you to specify a time and, optionally, a state to toggle a pin for. If another command is sent while a pin is being pulsed, the pulse will be cancelled. The message should be a JSON string with the following elements:
|
|
Pin state will be published here as |
|
Send |
|
See pulse above, |
Configuration
The following additional options are added to the configuration. Optional settings are commented out with default values shown.
i2c:
device-id:
device: ''
mcp230xx:
pin-id:
pin:
#name: '{pin_id}'
#direction: 'input'
#resistor: 'off'
#invert: false
#initial state: false
#first index: 0
batch-id:
pin: [ ]
#name: '{pin_id}'
#name: [ ] # can also provide a matching list of names
#direction: 'input'
#resistor: 'off'
#invert: false
#initial state: false
#first index: 0
Module Settings
Option |
Description |
---|---|
|
Available options are |
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 pin definitions:
Option |
Description |
---|---|
|
MCP230xx pin number. |
|
Friendly name for the pin. Substitutions:
Optional, default |
|
Pin direction, can be Optional, default |
|
Pin pull resistor for inputs, can be Optional, default |
|
Logic invert flag, can be Optional, default |
|
Initial state to set the pin to, must be one of
Optional, default |
Multiple Pin Definition
It is also possible to define settings for several pins at the same time. Settings from single pin definitions apply here also, except those shown below.
|
Instead of a single 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 |