mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Remove YAML warning for thethingsnetwork after warning for 6 months (#130307)
This commit is contained in:
parent
c52a893e21
commit
de5437f61e
@ -2,55 +2,15 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
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
|
from .coordinator import TTNCoordinator
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Establish connection with The Things Network."""
|
"""Establish connection with The Things Network."""
|
||||||
|
@ -22,11 +22,5 @@
|
|||||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
"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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,22 +4,6 @@ import pytest
|
|||||||
from ttn_client import TTNAuthError
|
from ttn_client import TTNAuthError
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
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])
|
@pytest.mark.parametrize(("exception_class"), [TTNAuthError, Exception])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user