mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Deprecate CLOSE_COMM_ON_ERROR (#99946)
This commit is contained in:
parent
71726130c3
commit
743ce46311
@ -34,6 +34,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
|
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||||
from homeassistant.helpers.reload import async_setup_reload_service
|
from homeassistant.helpers.reload import async_setup_reload_service
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
@ -255,6 +256,24 @@ class ModbusHub:
|
|||||||
def __init__(self, hass: HomeAssistant, client_config: dict[str, Any]) -> None:
|
def __init__(self, hass: HomeAssistant, client_config: dict[str, Any]) -> None:
|
||||||
"""Initialize the Modbus hub."""
|
"""Initialize the Modbus hub."""
|
||||||
|
|
||||||
|
if CONF_CLOSE_COMM_ON_ERROR in client_config:
|
||||||
|
async_create_issue( # pragma: no cover
|
||||||
|
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 remove in version 2024.4"
|
||||||
|
)
|
||||||
# generic configuration
|
# generic configuration
|
||||||
self._client: ModbusBaseClient | None = None
|
self._client: ModbusBaseClient | None = None
|
||||||
self._async_cancel_listener: Callable[[], None] | None = None
|
self._async_cancel_listener: Callable[[], None] | None = None
|
||||||
@ -274,7 +293,6 @@ class ModbusHub:
|
|||||||
self._pb_params = {
|
self._pb_params = {
|
||||||
"port": client_config[CONF_PORT],
|
"port": client_config[CONF_PORT],
|
||||||
"timeout": client_config[CONF_TIMEOUT],
|
"timeout": client_config[CONF_TIMEOUT],
|
||||||
"reset_socket": client_config[CONF_CLOSE_COMM_ON_ERROR],
|
|
||||||
"retries": client_config[CONF_RETRIES],
|
"retries": client_config[CONF_RETRIES],
|
||||||
"retry_on_empty": client_config[CONF_RETRY_ON_EMPTY],
|
"retry_on_empty": client_config[CONF_RETRY_ON_EMPTY],
|
||||||
}
|
}
|
||||||
|
@ -68,5 +68,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"issues": {
|
||||||
|
"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.\n\nCommunication is automatically closed on errors, see [the documentation]({url}) for other error handling parameters."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user