Deprecate modbus parameter retry_on_empty (#100292)
This commit is contained in:
parent
81af45347f
commit
9931f45532
4 changed files with 32 additions and 3 deletions
|
@ -344,7 +344,7 @@ MODBUS_SCHEMA = vol.Schema(
|
|||
vol.Optional(CONF_CLOSE_COMM_ON_ERROR): cv.boolean,
|
||||
vol.Optional(CONF_DELAY, default=0): cv.positive_int,
|
||||
vol.Optional(CONF_RETRIES, default=3): cv.positive_int,
|
||||
vol.Optional(CONF_RETRY_ON_EMPTY, default=False): cv.boolean,
|
||||
vol.Optional(CONF_RETRY_ON_EMPTY): cv.boolean,
|
||||
vol.Optional(CONF_MSG_WAIT): cv.positive_int,
|
||||
vol.Optional(CONF_BINARY_SENSORS): vol.All(
|
||||
cv.ensure_list, [BINARY_SENSOR_SCHEMA]
|
||||
|
|
|
@ -276,7 +276,25 @@ class ModbusHub:
|
|||
},
|
||||
)
|
||||
_LOGGER.warning(
|
||||
"`close_comm_on_error`: is deprecated and will be remove in version 2024.4"
|
||||
"`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,
|
||||
DOMAIN,
|
||||
"deprecated_retry_on_empty",
|
||||
breaks_in_ha_version="2024.4.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_retry_on_empty",
|
||||
translation_placeholders={
|
||||
"config_key": "retry_on_empty",
|
||||
"integration": DOMAIN,
|
||||
"url": "https://www.home-assistant.io/integrations/modbus",
|
||||
},
|
||||
)
|
||||
_LOGGER.warning(
|
||||
"`retry_on_empty`: is deprecated and will be removed in version 2024.4"
|
||||
)
|
||||
# generic configuration
|
||||
self._client: ModbusBaseClient | None = None
|
||||
|
@ -298,7 +316,7 @@ class ModbusHub:
|
|||
"port": client_config[CONF_PORT],
|
||||
"timeout": client_config[CONF_TIMEOUT],
|
||||
"retries": client_config[CONF_RETRIES],
|
||||
"retry_on_empty": client_config[CONF_RETRY_ON_EMPTY],
|
||||
"retry_on_empty": True,
|
||||
}
|
||||
if self._config_type == SERIAL:
|
||||
# serial configuration
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
"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."
|
||||
},
|
||||
"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."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ from homeassistant.components.modbus.const import (
|
|||
CONF_INPUT_TYPE,
|
||||
CONF_MSG_WAIT,
|
||||
CONF_PARITY,
|
||||
CONF_RETRY_ON_EMPTY,
|
||||
CONF_SLAVE_COUNT,
|
||||
CONF_STOPBITS,
|
||||
CONF_SWAP,
|
||||
|
@ -420,6 +421,12 @@ async def test_duplicate_entity_validator(do_config) -> None:
|
|||
CONF_PORT: TEST_PORT_TCP,
|
||||
CONF_CLOSE_COMM_ON_ERROR: True,
|
||||
},
|
||||
{
|
||||
CONF_TYPE: TCP,
|
||||
CONF_HOST: TEST_MODBUS_HOST,
|
||||
CONF_PORT: TEST_PORT_TCP,
|
||||
CONF_RETRY_ON_EMPTY: True,
|
||||
},
|
||||
{
|
||||
CONF_TYPE: TCP,
|
||||
CONF_HOST: TEST_MODBUS_HOST,
|
||||
|
|
Loading…
Add table
Reference in a new issue