Deprecate parameter "retries" in modbus (#105024)

This commit is contained in:
jan iversen 2023-12-24 16:47:22 +01:00 committed by GitHub
parent 771409579a
commit 9066555feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -260,6 +260,24 @@ class ModbusHub:
def __init__(self, hass: HomeAssistant, client_config: dict[str, Any]) -> None:
"""Initialize the Modbus hub."""
if CONF_RETRIES in client_config:
async_create_issue(
hass,
DOMAIN,
"deprecated_retries",
breaks_in_ha_version="2024.7.0",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key="deprecated_retries",
translation_placeholders={
"config_key": "retries",
"integration": DOMAIN,
"url": "https://www.home-assistant.io/integrations/modbus",
},
)
_LOGGER.warning(
"`retries`: is deprecated and will be removed in version 2024.7"
)
if CONF_CLOSE_COMM_ON_ERROR in client_config:
async_create_issue(
hass,
@ -315,7 +333,7 @@ class ModbusHub:
self._pb_params = {
"port": client_config[CONF_PORT],
"timeout": client_config[CONF_TIMEOUT],
"retries": client_config[CONF_RETRIES],
"retries": 3,
"retry_on_empty": True,
}
if self._config_type == SERIAL:

View File

@ -74,6 +74,10 @@
"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_retries": {
"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."