Add deprecated_yaml issue to the homeassistant integration (#95980)

* Add deprecated_yaml issue to the homeassistant integration

* Update test

* Update homeassistant/components/homeassistant/strings.json

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Include DOMAIN in issue_id

* Update test

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Erik Montnemery 2023-07-10 13:06:52 +02:00 committed by GitHub
parent 96c71b214f
commit 08a5f63474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 105 additions and 103 deletions

View file

@ -13,7 +13,7 @@ from homeassistant.components.sensor import (
)
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
@ -45,12 +45,17 @@ async def async_setup_platform(
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.11.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Brottsplatskartan",
},
)
hass.async_create_task(

View file

@ -16,12 +16,6 @@
}
}
},
"issues": {
"deprecated_yaml": {
"title": "The Brottsplatskartan YAML configuration is being removed",
"description": "Configuring Brottsplatskartan using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Brottsplatskartan YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
},
"selector": {
"areas": {
"options": {

View file

@ -22,7 +22,7 @@ from homeassistant.components.sensor import (
)
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
@ -89,12 +89,17 @@ async def async_setup_platform(
# Show issue as long as the YAML configuration exists.
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Deutscher Wetterdienst (DWD) Weather Warnings",
},
)
hass.async_create_task(

View file

@ -15,11 +15,5 @@
"already_configured": "Warncell ID / name is already configured.",
"invalid_identifier": "[%key:component::dwd_weather_warnings::config::error::invalid_identifier%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The Deutscher Wetterdienst (DWD) Weather Warnings YAML configuration is being removed",
"description": "Configuring Deutscher Wetterdienst (DWD) Weather Warnings using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Deutscher Wetterdienst (DWD) Weather Warnings YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -7,6 +7,7 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
@ -31,12 +32,17 @@ class DynaliteFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
# Raise an issue that this is deprecated and has been imported
async_create_issue(
self.hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
is_fixable=False,
is_persistent=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Dynalite",
},
)
host = import_info[CONF_HOST]

View file

@ -14,11 +14,5 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The Dynalite YAML configuration is being removed",
"description": "Configuring Dynalite using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Dynalite YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -17,7 +17,7 @@ from homeassistant.const import (
CONF_URL,
UnitOfLength,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -81,12 +81,17 @@ async def async_setup_platform(
"""Set up the GeoJSON Events platform."""
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "GeoJSON feed",
},
)
hass.async_create_task(
hass.config_entries.flow.async_init(

View file

@ -12,11 +12,5 @@
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The GeoJSON feed YAML configuration is being removed",
"description": "Configuring a GeoJSON feed using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the GeoJSON feed YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -4,6 +4,10 @@
"title": "The country has not been configured",
"description": "No country has been configured, please update the configuration by clicking on the \"learn more\" button below."
},
"deprecated_yaml": {
"title": "The {integration_title} YAML configuration is being removed",
"description": "Configuring {integration_title} using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the `{domain}` configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
},
"historic_currency": {
"title": "The configured currency is no longer in use",
"description": "The currency {currency} is no longer in use, please reconfigure the currency configuration."

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_API_KEY
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
@ -51,12 +51,17 @@ async def async_setup_platform(
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "LastFM",
},
)
hass.async_create_task(

View file

@ -35,11 +35,5 @@
"invalid_account": "Invalid username",
"unknown": "[%key:common::config_flow::error::unknown%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The LastFM YAML configuration is being removed",
"description": "Configuring LastFM using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the LastFM YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -18,7 +18,7 @@ from homeassistant.components.light import (
)
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -61,12 +61,17 @@ async def async_setup_platform(
"""Set up the myStrom light integration."""
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "myStrom",
},
)
hass.async_create_task(
hass.config_entries.flow.async_init(

View file

@ -14,11 +14,5 @@
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The myStrom YAML configuration is being removed",
"description": "Configuring myStrom using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the myStrom YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -10,7 +10,7 @@ import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -48,12 +48,17 @@ async def async_setup_platform(
"""Set up the myStrom switch/plug integration."""
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "myStrom",
},
)
hass.async_create_task(
hass.config_entries.flow.async_init(

View file

@ -23,7 +23,7 @@ from homeassistant.const import (
STATE_IDLE,
UnitOfDataRate,
)
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.helpers import issue_registry as ir
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -84,12 +84,17 @@ async def async_setup_platform(
)
ir.async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.11.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=ir.IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "qBittorrent",
},
)

View file

@ -17,11 +17,5 @@
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The qBittorrent YAML configuration is being removed",
"description": "Configuring qBittorrent using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the qBittorrent YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -28,7 +28,7 @@ from homeassistant.const import (
UnitOfInformation,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import DeviceInfo
@ -235,12 +235,17 @@ async def async_setup_platform(
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.12.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "QNAP",
},
)
hass.async_create_task(

View file

@ -19,11 +19,5 @@
"invalid_auth": "Bad authentication",
"unknown": "Unknown error"
}
},
"issues": {
"deprecated_yaml": {
"title": "The QNAP YAML configuration is being removed",
"description": "Configuring QNAP using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the QNAP YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -14,7 +14,7 @@ from homeassistant.components.media_player import (
)
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
@ -102,12 +102,17 @@ async def async_setup_platform(
"""Set up the Snapcast platform."""
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.11.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Snapcast",
},
)
config[CONF_PORT] = config.get(CONF_PORT, CONTROL_PORT)

View file

@ -17,11 +17,5 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_host": "[%key:common::config_flow::error::invalid_host%]"
}
},
"issues": {
"deprecated_yaml": {
"title": "The Snapcast YAML configuration is being removed",
"description": "Configuring Snapcast using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Snapcast YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -14,7 +14,7 @@ from homeassistant.components.binary_sensor import (
)
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
@ -90,12 +90,17 @@ async def async_setup_platform(
"""Set up the Workday sensor."""
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2023.11.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Workday",
},
)
hass.async_create_task(

View file

@ -65,12 +65,6 @@
"already_configured": "Service with this configuration already exist"
}
},
"issues": {
"deprecated_yaml": {
"title": "The Workday YAML configuration is being removed",
"description": "Configuring Workday using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Workday YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
},
"selector": {
"province": {
"options": {

View file

@ -3,7 +3,7 @@ import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
from homeassistant.helpers.typing import ConfigType
@ -20,12 +20,17 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async_create_issue(
hass,
DOMAIN,
"deprecated_yaml",
HOMEASSISTANT_DOMAIN,
f"deprecated_yaml_{DOMAIN}",
breaks_in_ha_version="2024.1.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_yaml",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Zodiac",
},
)
hass.async_create_task(

View file

@ -28,11 +28,5 @@
}
}
}
},
"issues": {
"deprecated_yaml": {
"title": "The Zodiac YAML configuration is being removed",
"description": "Configuring Zodiac using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Zodiac YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -6,7 +6,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components import dynalite
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.helpers.issue_registry import (
IssueSeverity,
async_get as async_get_issue_registry,
@ -52,8 +52,11 @@ async def test_flow(
assert result["result"].state == exp_result
if exp_reason:
assert result["reason"] == exp_reason
issue = registry.async_get_issue(dynalite.DOMAIN, "deprecated_yaml")
issue = registry.async_get_issue(
HOMEASSISTANT_DOMAIN, f"deprecated_yaml_{dynalite.DOMAIN}"
)
assert issue is not None
assert issue.issue_domain == dynalite.DOMAIN
assert issue.severity == IssueSeverity.WARNING