From 6cdd34146582c6c69864ff71d5f9de4df57b3673 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 21 Dec 2021 13:03:29 +0100 Subject: [PATCH] Deprecate mcp23017 integration (ADR-0019) (#62484) --- homeassistant/components/mcp23017/binary_sensor.py | 10 ++++++++++ homeassistant/components/mcp23017/switch.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/homeassistant/components/mcp23017/binary_sensor.py b/homeassistant/components/mcp23017/binary_sensor.py index c650393a26f..592bc4aa5e3 100644 --- a/homeassistant/components/mcp23017/binary_sensor.py +++ b/homeassistant/components/mcp23017/binary_sensor.py @@ -1,4 +1,6 @@ """Support for binary sensor using I2C MCP23017 chip.""" +import logging + from adafruit_mcp230xx.mcp23017 import MCP23017 import board import busio @@ -34,9 +36,17 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( } ) +_LOGGER = logging.getLogger(__name__) + def setup_platform(hass, config, add_devices, discovery_info=None): """Set up the MCP23017 binary sensors.""" + _LOGGER.warning( + "The MCP23017 I/O Expander integration is deprecated and will be removed " + "in Home Assistant Core 2022.4; this integration is removed under " + "Architectural Decision Record 0019, more information can be found here: " + "https://github.com/home-assistant/architecture/blob/master/adr/0019-GPIO.md" + ) pull_mode = config[CONF_PULL_MODE] invert_logic = config[CONF_INVERT_LOGIC] i2c_address = config[CONF_I2C_ADDRESS] diff --git a/homeassistant/components/mcp23017/switch.py b/homeassistant/components/mcp23017/switch.py index 6b1ced540ae..5c4c06a585a 100644 --- a/homeassistant/components/mcp23017/switch.py +++ b/homeassistant/components/mcp23017/switch.py @@ -1,4 +1,6 @@ """Support for switch sensor using I2C MCP23017 chip.""" +import logging + from adafruit_mcp230xx.mcp23017 import MCP23017 import board import busio @@ -28,9 +30,17 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( } ) +_LOGGER = logging.getLogger(__name__) + def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the MCP23017 devices.""" + _LOGGER.warning( + "The MCP23017 I/O Expander integration is deprecated and will be removed " + "in Home Assistant Core 2022.4; this integration is removed under " + "Architectural Decision Record 0019, more information can be found here: " + "https://github.com/home-assistant/architecture/blob/master/adr/0019-GPIO.md" + ) invert_logic = config.get(CONF_INVERT_LOGIC) i2c_address = config.get(CONF_I2C_ADDRESS)