mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
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>
This commit is contained in:
parent
e18dd4da16
commit
5d9e462118
@ -28,7 +28,7 @@ from homeassistant.const import (
|
|||||||
CONF_UNIQUE_ID,
|
CONF_UNIQUE_ID,
|
||||||
CONF_VALUE_TEMPLATE,
|
CONF_VALUE_TEMPLATE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant, callback
|
from homeassistant.core import Event, HomeAssistant, async_get_hass, callback
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
device_registry as dr,
|
device_registry as dr,
|
||||||
@ -48,6 +48,7 @@ from homeassistant.helpers.entity import (
|
|||||||
async_generate_entity_id,
|
async_generate_entity_id,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
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.json import json_loads
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
@ -245,6 +246,20 @@ def warn_for_legacy_schema(domain: str) -> Callable:
|
|||||||
domain,
|
domain,
|
||||||
)
|
)
|
||||||
warned.add(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 config
|
||||||
|
|
||||||
return validator
|
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": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"broker": {
|
"broker": {
|
||||||
|
@ -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": {
|
"config": {
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Service is already configured",
|
"already_configured": "Service is already configured",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user