esphome-docs/components/mcp23017.rst
2019-03-14 16:41:37 +01:00

54 lines
1.4 KiB
ReStructuredText

MCP23017 I/O Expander
=====================
.. seo::
:description: Instructions for setting up MCP23017 digital port expanders in ESPHome.
:image: mcp23017.png
The MCP23017 component allows you to use MCP23017 I/O expanders
(`datasheet <http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf>`__,
`Adafruit <https://www.adafruit.com/product/732>`__) in ESPHome.
It uses the :ref:`I²C Bus <i2c>` for communication.
Once configured, you can use any of the 16 pins as
pins for your projects. Within ESPHome they emulate a real internal GPIO pin
and can therefore be used with many of ESPHome's components such as the GPIO
binary sensor or GPIO switch.
.. code-block:: yaml
# Example configuration entry
mcp23017:
- id: 'mcp23017_hub'
address: 0x20
# Individual outputs
switch:
- platform: gpio
name: "MCP23017 Pin #0"
pin:
mcp23017: mcp23017_hub
# Use pin number 0
number: 0
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **id** (**Required**, :ref:`config-id`): The id to use for this MCP23017 component.
- **address** (*Optional*, int): The I²C address of the driver.
Defaults to ``0x21``.
See Also
--------
- :ref:`i2c`
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
- :apiref:`io/mcp23017.h`
- :ghedit:`Edit`
.. disqus::