Add repair for deprecated MQTT yaml config (#77174)
* Add repair for deprecated MQTT yaml config * Update homeassistant/components/mqtt/strings.json Co-authored-by: Erik Montnemery <erik@montnemery.com> * Update homeassistant/components/mqtt/strings.json Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Add restart instruction * Update homeassistant/components/mqtt/strings.json Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update English translation * update issue_registry imports * Update homeassistant/components/mqtt/manifest.json Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/75682/head^2
parent
e18dd4da16
commit
5d9e462118
homeassistant/components/mqtt
|
@ -28,7 +28,7 @@ from homeassistant.const import (
|
|||
CONF_UNIQUE_ID,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.core import Event, HomeAssistant, async_get_hass, callback
|
||||
from homeassistant.helpers import (
|
||||
config_validation as cv,
|
||||
device_registry as dr,
|
||||
|
@ -48,6 +48,7 @@ from homeassistant.helpers.entity import (
|
|||
async_generate_entity_id,
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.json import json_loads
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
|
@ -245,6 +246,20 @@ def warn_for_legacy_schema(domain: str) -> Callable:
|
|||
domain,
|
||||
)
|
||||
warned.add(domain)
|
||||
# Register a repair
|
||||
async_create_issue(
|
||||
async_get_hass(),
|
||||
DOMAIN,
|
||||
f"deprecated_yaml_{domain}",
|
||||
breaks_in_ha_version="2022.12.0", # Warning first added in 2022.6.0
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_yaml",
|
||||
translation_placeholders={
|
||||
"more_info_url": f"https://www.home-assistant.io/integrations/{domain}.mqtt/#new_format",
|
||||
"platform": domain,
|
||||
},
|
||||
)
|
||||
return config
|
||||
|
||||
return validator
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{
|
||||
"issues": {
|
||||
"deprecated_yaml": {
|
||||
"title": "Your manually configured MQTT {platform}(s) needs attention",
|
||||
"description": "Manually configured MQTT {platform}(s) found under platform key `{platform}`.\n\nPlease move the configuration to the `mqtt` integration key and restart Home Assistant to fix this issue. See the [documentation]({more_info_url}), for more information."
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"step": {
|
||||
"broker": {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"config": {
|
||||
"issues": {
|
||||
"deprecated_yaml": {
|
||||
"title": "Your manually configured MQTT {platform}(s) needs attention",
|
||||
"description": "Manually configured MQTT {platform}(s) found under platform key `{platform}`.\n\nPlease move the configuration to the `mqtt` integration key and restart Home Assistant to fix this issue. See the [documentation]({more_info_url}), for more information."
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "Service is already configured",
|
||||
"single_instance_allowed": "Already configured. Only a single configuration possible."
|
||||
|
|
Loading…
Reference in New Issue