From bc0b298775b1c17cd92e596816ef3a23f324dcaa Mon Sep 17 00:00:00 2001 From: "Jardi A.M. Jordan" <1088732+jardiamj@users.noreply.github.com> Date: Mon, 15 Apr 2019 13:53:42 -0700 Subject: [PATCH 1/9] Added documentation for MCP23017 component: binary sensor and switch platforms. --- source/_components/mcp23017.markdown | 128 +++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 source/_components/mcp23017.markdown diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown new file mode 100644 index 00000000000..af488631203 --- /dev/null +++ b/source/_components/mcp23017.markdown @@ -0,0 +1,128 @@ +--- +layout: page +title: "MCP23017 I2C GPIO expander" +description: "Instructions on how to integrate the MCP23017 GPIO pin expander with I2C interface into Home Assistant." +date: 2019-04-14 07:00 +sidebar: true +comments: false +sharing: true +footer: true +logo: raspberry-pi.png +ha_category: + - DIY + - Binary Sensor + - Switch +ha_release: 0.92 +ha_iot_class: Local Polling +redirect_from: + - /components/binary_sensor.mcp23017/ + - /components/switch.mcp23017/ +--- + +The `mcp23017` component is the base for all related mcp23017 platforms in Home Assistant. There is no setup needed for the component itself, for the platforms please check their corresponding pages. + +## {% linkable_title Binary Sensor %} + +The `mcp23017` binary sensor platform allows you to read sensor values from the I/O pins of your [MCP23017 I2C I/O expander](https://www.adafruit.com/product/732). + +The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-15 to port B (B1-B8). + +## {% linkable_title Configuration %} + +To use the I/O pins of an mcp23017 connected to and I2C bus of your Raspberry Pi as binary sensors, add the following to your `configuration.yaml` file: + +```yaml +# Example configuration.yaml entry +binary_sensor: + - platform: mcp23017 + i2c_address: 0x20 + pins: + 0: PIR Office + 1: PIR Bedroom +``` + +{% configuration %} +i2c_address: + description: i2c address of MCP23017 chip. + required: false + type: integer + default: "`0x20`" +pins: + description: List of used pins. + required: true + type: map + keys: + "pin: name": + description: The pin numbers (from 0 to 15) and corresponding names. + required: true + type: [integer, string] +scan_interval: + description: Interval to scan for sensor state changes in seconds. + required: false + type: integer + default: 15 +invert_logic: + description: If `true`, inverts the output logic to ACTIVE LOW. + required: false + type: boolean + default: "`false` (ACTIVE HIGH)" +pull_mode: + description: > + Type of internal pull resistor to use. + Options are `UP` - pull-up resistor and `DOWN` - pull-down resistor. + required: false + type: string + default: "`UP`" +{% endconfiguration %} + +NOTE: MCP23017 only has internal pull-up resistors, if you want to use pull-down you will have to wire your own pull-down resistors. + +For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). + +## {% linkable_title Switch %} + +The `mcp23017` switch platform allows you to write to the I/O pins of your [MCP23017 I2C I/O expander](https://www.adafruit.com/product/732). + +The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-15 to port B (B1-B8). + +## {% linkable_title Configuration %} + +To use the I/O pins of an mcp23017 connected to and I2C bus of your Raspberry Pi as switches, add the following to your `configuration.yaml` file: + +```yaml +# Example configuration.yaml entry +switch: + - platform: mcp23017 + i2c_address: 0x20 + ports: + 11: Fan Office + 12: Light Desk +``` + +{% configuration %} +i2c_address: + description: i2c address of MCP23017 chip. + required: false + type: integer + default: "`0x20`" +ports: + description: Array of used pins. + required: true + type: list + keys: + port: + description: The pin numbers (from 0 to 15) and corresponding names. + required: true + type: [integer, string] +invert_logic: + description: If true, inverts the output logic to ACTIVE LOW. + required: false + default: false + type: boolean +{% endconfiguration %} + +For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). + +

+Note that a pin managed by HASS is expected to be exclusive to HASS. +

From 66ae490ec220cfbd3b0fea74d36db3127948d03b Mon Sep 17 00:00:00 2001 From: "Jardi A.M. Jordan" <1088732+jardiamj@users.noreply.github.com> Date: Mon, 15 Apr 2019 15:50:01 -0700 Subject: [PATCH 2/9] Removed redirect_from: label. --- source/_components/mcp23017.markdown | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index af488631203..8cc30cfefbe 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -14,9 +14,6 @@ ha_category: - Switch ha_release: 0.92 ha_iot_class: Local Polling -redirect_from: - - /components/binary_sensor.mcp23017/ - - /components/switch.mcp23017/ --- The `mcp23017` component is the base for all related mcp23017 platforms in Home Assistant. There is no setup needed for the component itself, for the platforms please check their corresponding pages. From 6c0aaf8a4e4d753f2109c98e2ea971b07c3f9f02 Mon Sep 17 00:00:00 2001 From: Jardi Martinez <1088732+jardiamj@users.noreply.github.com> Date: Tue, 7 May 2019 16:00:08 -0700 Subject: [PATCH 3/9] Update mcp23017.markdown --- source/_components/mcp23017.markdown | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index 8cc30cfefbe..b5b9ca0338e 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -91,7 +91,7 @@ To use the I/O pins of an mcp23017 connected to and I2C bus of your Raspberry Pi switch: - platform: mcp23017 i2c_address: 0x20 - ports: + pins: 11: Fan Office 12: Light Desk ``` @@ -119,7 +119,3 @@ invert_logic: {% endconfiguration %} For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). - -

-Note that a pin managed by HASS is expected to be exclusive to HASS. -

From ea232283b3c14a4c70924a4df64eb38edb7d0972 Mon Sep 17 00:00:00 2001 From: Jardi Martinez <1088732+jardiamj@users.noreply.github.com> Date: Sat, 25 May 2019 17:34:41 -0700 Subject: [PATCH 4/9] Update source/_components/mcp23017.markdown Co-Authored-By: Anders Melchiorsen --- source/_components/mcp23017.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index b5b9ca0338e..6eb6cf88fcc 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -16,7 +16,7 @@ ha_release: 0.92 ha_iot_class: Local Polling --- -The `mcp23017` component is the base for all related mcp23017 platforms in Home Assistant. There is no setup needed for the component itself, for the platforms please check their corresponding pages. +The `mcp23017` component is the base for all related mcp23017 platforms in Home Assistant. There is no setup needed for the component itself, for the platforms please check their corresponding sections. ## {% linkable_title Binary Sensor %} From 29f831a0fd51a16ee7e24e0c719de3e7d1073998 Mon Sep 17 00:00:00 2001 From: Jardi Martinez <1088732+jardiamj@users.noreply.github.com> Date: Sat, 25 May 2019 17:34:50 -0700 Subject: [PATCH 5/9] Update source/_components/mcp23017.markdown Co-Authored-By: Anders Melchiorsen --- source/_components/mcp23017.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index 6eb6cf88fcc..bad3108f9b1 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -26,7 +26,7 @@ The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-1 ## {% linkable_title Configuration %} -To use the I/O pins of an mcp23017 connected to and I2C bus of your Raspberry Pi as binary sensors, add the following to your `configuration.yaml` file: +To use the I/O pins of an mcp23017 connected to an I2C bus of your Raspberry Pi as binary sensors, add the following to your `configuration.yaml` file: ```yaml # Example configuration.yaml entry From 1094afdcde75b16278526a6bf6b17ccf1025ad60 Mon Sep 17 00:00:00 2001 From: Jardi Martinez <1088732+jardiamj@users.noreply.github.com> Date: Sat, 25 May 2019 17:35:03 -0700 Subject: [PATCH 6/9] Update source/_components/mcp23017.markdown Co-Authored-By: Anders Melchiorsen --- source/_components/mcp23017.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index bad3108f9b1..b3584bf9a63 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -84,7 +84,7 @@ The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-1 ## {% linkable_title Configuration %} -To use the I/O pins of an mcp23017 connected to and I2C bus of your Raspberry Pi as switches, add the following to your `configuration.yaml` file: +To use the I/O pins of an mcp23017 connected to an I2C bus of your Raspberry Pi as switches, add the following to your `configuration.yaml` file: ```yaml # Example configuration.yaml entry From b074788c96b08e0ad8e36d8c0eec01de6e49a5b1 Mon Sep 17 00:00:00 2001 From: "Jardi A. Martinez Jordan" <1088732+jardiamj@users.noreply.github.com> Date: Sat, 25 May 2019 18:18:59 -0700 Subject: [PATCH 7/9] Updated documentation for mcp23017 component. --- source/_components/mcp23017.markdown | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index b3584bf9a63..f7c71b9119b 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -18,13 +18,15 @@ ha_iot_class: Local Polling The `mcp23017` component is the base for all related mcp23017 platforms in Home Assistant. There is no setup needed for the component itself, for the platforms please check their corresponding sections. +For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). + ## {% linkable_title Binary Sensor %} The `mcp23017` binary sensor platform allows you to read sensor values from the I/O pins of your [MCP23017 I2C I/O expander](https://www.adafruit.com/product/732). The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-15 to port B (B1-B8). -## {% linkable_title Configuration %} +### {% linkable_title Configuration %} To use the I/O pins of an mcp23017 connected to an I2C bus of your Raspberry Pi as binary sensors, add the following to your `configuration.yaml` file: @@ -74,15 +76,13 @@ pull_mode: NOTE: MCP23017 only has internal pull-up resistors, if you want to use pull-down you will have to wire your own pull-down resistors. -For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). - ## {% linkable_title Switch %} The `mcp23017` switch platform allows you to write to the I/O pins of your [MCP23017 I2C I/O expander](https://www.adafruit.com/product/732). The pin numbers are from 0 to 15 where: 0-7 correspond to port A (A1-A8) and 8-15 to port B (B1-B8). -## {% linkable_title Configuration %} +### {% linkable_title Configuration %} To use the I/O pins of an mcp23017 connected to an I2C bus of your Raspberry Pi as switches, add the following to your `configuration.yaml` file: @@ -117,5 +117,3 @@ invert_logic: default: false type: boolean {% endconfiguration %} - -For more details about the MCP23017 I2C I/O port expander you can find its datasheet here: [MCP23017](https://www.microchip.com/wwwproducts/en/MCP23017). From e7e18cc24b96752c041f492503e6da7914feea80 Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Wed, 29 May 2019 23:43:35 +0200 Subject: [PATCH 8/9] :pencil2: Tweak After this we will merge it --- source/_components/mcp23017.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index f7c71b9119b..2ac764d35ec 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -12,7 +12,7 @@ ha_category: - DIY - Binary Sensor - Switch -ha_release: 0.92 +ha_release: 0.94 ha_iot_class: Local Polling --- From fae2293b1552927bb15ff7621e3f3cdba46f882a Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Wed, 29 May 2019 23:53:13 +0200 Subject: [PATCH 9/9] :pencil2: Put something in a html note --- source/_components/mcp23017.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/_components/mcp23017.markdown b/source/_components/mcp23017.markdown index 2ac764d35ec..4629de4e426 100644 --- a/source/_components/mcp23017.markdown +++ b/source/_components/mcp23017.markdown @@ -74,7 +74,9 @@ pull_mode: default: "`UP`" {% endconfiguration %} -NOTE: MCP23017 only has internal pull-up resistors, if you want to use pull-down you will have to wire your own pull-down resistors. +

+ MCP23017 only has internal pull-up resistors, if you want to use pull-down you will have to wire your own pull-down resistors. +

## {% linkable_title Switch %}