mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Deprecate modbus:restart service (#115754)
This commit is contained in:
parent
e90d76b18d
commit
640dc56c51
@ -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()
|
||||
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user