mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Remove YAML import from Tile (#134108)
This commit is contained in:
parent
7df9d2e938
commit
9976c07f89
@ -71,10 +71,6 @@ class TileFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return self.async_create_entry(title=self._username, data=data)
|
||||
|
||||
async def async_step_import(self, import_data: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
return await self.async_step_user(import_data)
|
||||
|
||||
async def async_step_reauth(
|
||||
self, entry_data: Mapping[str, Any]
|
||||
) -> ConfigFlowResult:
|
||||
|
@ -4,13 +4,12 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.components.device_tracker import AsyncSeeCallback, TrackerEntity
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.components.device_tracker import TrackerEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.util.dt import as_utc
|
||||
|
||||
@ -44,32 +43,6 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_scanner(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_see: AsyncSeeCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> bool:
|
||||
"""Detect a legacy configuration and import it."""
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data={
|
||||
CONF_USERNAME: config[CONF_USERNAME],
|
||||
CONF_PASSWORD: config[CONF_PASSWORD],
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
_LOGGER.debug(
|
||||
"Your Tile configuration has been imported into the UI; "
|
||||
"please remove it from configuration.yaml"
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class TileDeviceTracker(CoordinatorEntity[TileCoordinator], TrackerEntity):
|
||||
"""Representation of a network infrastructure device."""
|
||||
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from pytile.errors import InvalidAuthError, TileError
|
||||
|
||||
from homeassistant.components.tile import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
@ -65,19 +65,6 @@ async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry)
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_import_entry(hass: HomeAssistant, config, mock_pytile) -> None:
|
||||
"""Test importing an entry."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=config
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == TEST_USERNAME
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: TEST_USERNAME,
|
||||
CONF_PASSWORD: TEST_PASSWORD,
|
||||
}
|
||||
|
||||
|
||||
async def test_step_reauth(
|
||||
hass: HomeAssistant, config, config_entry: MockConfigEntry, setup_config_entry
|
||||
) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user