From 797983236f20b9e89ea5c79d7d05c75df33d97d9 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Sat, 9 Mar 2024 13:24:06 +0100 Subject: [PATCH] Remove deprecated CLOSE_COMM_ON_ERROR from modbus (#112821) --- homeassistant/components/modbus/__init__.py | 2 -- homeassistant/components/modbus/const.py | 1 - homeassistant/components/modbus/modbus.py | 19 ------------------- homeassistant/components/modbus/strings.json | 4 ---- tests/components/modbus/test_init.py | 2 -- 5 files changed, 28 deletions(-) diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index 8224a79c835..09112e16767 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -61,7 +61,6 @@ from .const import ( # noqa: F401 CONF_BAUDRATE, CONF_BYTESIZE, CONF_CLIMATES, - CONF_CLOSE_COMM_ON_ERROR, CONF_DATA_TYPE, CONF_DEVICE_ADDRESS, CONF_FAN_MODE_AUTO, @@ -374,7 +373,6 @@ MODBUS_SCHEMA = vol.Schema( { vol.Optional(CONF_NAME, default=DEFAULT_HUB): cv.string, vol.Optional(CONF_TIMEOUT, default=3): cv.socket_timeout, - vol.Optional(CONF_CLOSE_COMM_ON_ERROR): cv.boolean, vol.Optional(CONF_DELAY, default=0): cv.positive_int, vol.Optional(CONF_RETRIES): cv.positive_int, vol.Optional(CONF_RETRY_ON_EMPTY): cv.boolean, diff --git a/homeassistant/components/modbus/const.py b/homeassistant/components/modbus/const.py index a2b3324c4ee..3a7b25ad786 100644 --- a/homeassistant/components/modbus/const.py +++ b/homeassistant/components/modbus/const.py @@ -16,7 +16,6 @@ from homeassistant.const import ( CONF_BAUDRATE = "baudrate" CONF_BYTESIZE = "bytesize" CONF_CLIMATES = "climates" -CONF_CLOSE_COMM_ON_ERROR = "close_comm_on_error" CONF_DATA_TYPE = "data_type" CONF_DEVICE_ADDRESS = "device_address" CONF_FANS = "fans" diff --git a/homeassistant/components/modbus/modbus.py b/homeassistant/components/modbus/modbus.py index 498dcbf0f7e..36c081df616 100644 --- a/homeassistant/components/modbus/modbus.py +++ b/homeassistant/components/modbus/modbus.py @@ -51,7 +51,6 @@ from .const import ( CALL_TYPE_WRITE_REGISTERS, CONF_BAUDRATE, CONF_BYTESIZE, - CONF_CLOSE_COMM_ON_ERROR, CONF_MSG_WAIT, CONF_PARITY, CONF_RETRIES, @@ -273,24 +272,6 @@ class ModbusHub: ) else: client_config[CONF_RETRIES] = 3 - if CONF_CLOSE_COMM_ON_ERROR in client_config: - async_create_issue( - hass, - DOMAIN, - "deprecated_close_comm_config", - breaks_in_ha_version="2024.4.0", - is_fixable=False, - severity=IssueSeverity.WARNING, - translation_key="deprecated_close_comm_config", - translation_placeholders={ - "config_key": "close_comm_on_error", - "integration": DOMAIN, - "url": "https://www.home-assistant.io/integrations/modbus", - }, - ) - _LOGGER.warning( - "`close_comm_on_error`: is deprecated and will be removed in version 2024.4" - ) if CONF_RETRY_ON_EMPTY in client_config: async_create_issue( hass, diff --git a/homeassistant/components/modbus/strings.json b/homeassistant/components/modbus/strings.json index 12e66f5d2ca..12023579669 100644 --- a/homeassistant/components/modbus/strings.json +++ b/homeassistant/components/modbus/strings.json @@ -78,10 +78,6 @@ "title": "`{config_key}` configuration key is being removed", "description": "Please remove the `{config_key}` key from the {integration} entry in your configuration.yaml file and restart Home Assistant to fix this issue.\n\nThe maximum number of retries is now fixed to 3." }, - "deprecated_close_comm_config": { - "title": "`{config_key}` configuration key is being removed", - "description": "Please remove the `{config_key}` key from the {integration} entry in your `configuration.yaml` file and restart Home Assistant to fix this issue. All errors will be reported, as `lazy_error_count` is accepted but ignored." - }, "deprecated_retry_on_empty": { "title": "`{config_key}` configuration key is being removed", "description": "Please remove the `{config_key}` key from the {integration} entry in your configuration.yaml file and restart Home Assistant to fix this issue.\n\nRetry on empty is automatically applied, see [the documentation]({url}) for other error handling parameters." diff --git a/tests/components/modbus/test_init.py b/tests/components/modbus/test_init.py index 3101f2d3376..20eecf49591 100644 --- a/tests/components/modbus/test_init.py +++ b/tests/components/modbus/test_init.py @@ -42,7 +42,6 @@ from homeassistant.components.modbus.const import ( CONF_BAUDRATE, CONF_BYTESIZE, CONF_CLIMATES, - CONF_CLOSE_COMM_ON_ERROR, CONF_DATA_TYPE, CONF_DEVICE_ADDRESS, CONF_FAN_MODE_HIGH, @@ -964,7 +963,6 @@ async def test_no_duplicate_names(do_config) -> None: CONF_TYPE: TCP, CONF_HOST: TEST_MODBUS_HOST, CONF_PORT: TEST_PORT_TCP, - CONF_CLOSE_COMM_ON_ERROR: True, }, { CONF_TYPE: TCP,