Deprecate modbus:restart service (#115754)

This commit is contained in:
jan iversen 2024-04-23 10:28:46 +02:00 committed by GitHub
parent e90d76b18d
commit 640dc56c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.dispatcher import async_dispatcher_send
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.typing import ConfigType
@ -234,6 +235,18 @@ async def async_modbus_setup(
async def async_restart_hub(service: ServiceCall) -> None:
"""Restart Modbus hub."""
async_create_issue(
hass,
DOMAIN,
"deprecated_restart",
breaks_in_ha_version="2024.11.0",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key="deprecated_restart",
)
_LOGGER.warning(
"`modbus.restart`: is deprecated and will be removed in version 2024.11"
)
async_dispatcher_send(hass, SIGNAL_START_ENTITY)
hub = hub_collect[service.data[ATTR_HUB]]
await hub.async_restart()

View File

@ -97,6 +97,10 @@
"no_entities": {
"title": "Modbus {sub_1} contain no entities, entry not loaded.",
"description": "Please add at least one entity to Modbus {sub_1} in your configuration.yaml file and restart Home Assistant to fix this issue."
},
"deprecated_restart": {
"title": "`modbus.restart` is being removed",
"description": "Please use reload yaml via the developer tools in the UI instead of via the `modbus.restart` service."
}
}
}