Skip to content

Commit

Permalink
Remove YAML import from Tile (#134108)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Dec 27, 2024
1 parent 7df9d2e commit 9976c07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 48 deletions.
4 changes: 0 additions & 4 deletions homeassistant/components/tile/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ async def _async_verify(self, step_id: str, schema: vol.Schema) -> ConfigFlowRes

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:
Expand Down
33 changes: 3 additions & 30 deletions homeassistant/components/tile/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

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

Expand Down Expand Up @@ -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."""

Expand Down
15 changes: 1 addition & 14 deletions tests/components/tile/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9976c07

Please sign in to comment.