Remove YAML warning for thethingsnetwork after warning for 6 months (#130307)

This commit is contained in:
Jan Bouwhuis 2024-11-10 22:12:31 +01:00 committed by GitHub
parent c52a893e21
commit de5437f61e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 63 deletions

View File

@ -2,55 +2,15 @@
import logging
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import CONF_APP_ID, DOMAIN, PLATFORMS, TTN_API_HOST
from .const import DOMAIN, PLATFORMS, TTN_API_HOST
from .coordinator import TTNCoordinator
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = vol.Schema(
{
# Configuration via yaml not longer supported - keeping to warn about migration
DOMAIN: vol.Schema(
{
vol.Required(CONF_APP_ID): cv.string,
vol.Required("access_key"): cv.string,
}
)
},
extra=vol.ALLOW_EXTRA,
)
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Initialize of The Things Network component."""
if DOMAIN in config:
ir.async_create_issue(
hass,
DOMAIN,
"manual_migration",
breaks_in_ha_version="2024.12.0",
is_fixable=False,
severity=ir.IssueSeverity.ERROR,
translation_key="manual_migration",
translation_placeholders={
"domain": DOMAIN,
"v2_v3_migration_url": "https://www.thethingsnetwork.org/forum/c/v2-to-v3-upgrade/102",
"v2_deprecation_url": "https://www.thethingsnetwork.org/forum/t/the-things-network-v2-is-permanently-shutting-down-completed/50710",
},
)
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Establish connection with The Things Network."""

View File

@ -22,11 +22,5 @@
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
}
},
"issues": {
"manual_migration": {
"description": "Configuring {domain} using YAML was removed as part of migrating to [The Things Network v3]({v2_v3_migration_url}). [The Things Network v2 has shutted down]({v2_deprecation_url}).\n\nPlease remove the {domain} entry from the configuration.yaml and add re-add the integration using the config_flow",
"title": "The {domain} YAML configuration is not supported"
}
}
}

View File

@ -4,22 +4,6 @@ import pytest
from ttn_client import TTNAuthError
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir
from homeassistant.setup import async_setup_component
from .conftest import DOMAIN
async def test_error_configuration(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test issue is logged when deprecated configuration is used."""
await async_setup_component(
hass, DOMAIN, {DOMAIN: {"app_id": "123", "access_key": "42"}}
)
await hass.async_block_till_done()
assert issue_registry.async_get_issue(DOMAIN, "manual_migration")
@pytest.mark.parametrize(("exception_class"), [TTNAuthError, Exception])