From 05cbb3f0e4343a3d70bd713c49cb39ffff5d52b3 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Mon, 25 May 2020 14:34:51 -0600 Subject: [PATCH] Remove WWLLN integration (#35926) --- .coveragerc | 2 - CODEOWNERS | 1 - homeassistant/components/wwlln/__init__.py | 102 -------- homeassistant/components/wwlln/config_flow.py | 70 ------ homeassistant/components/wwlln/const.py | 11 - .../components/wwlln/geo_location.py | 228 ------------------ homeassistant/components/wwlln/manifest.json | 8 - homeassistant/components/wwlln/strings.json | 15 -- .../components/wwlln/translations/bg.json | 14 -- .../components/wwlln/translations/ca.json | 17 -- .../components/wwlln/translations/cy.json | 14 -- .../components/wwlln/translations/da.json | 14 -- .../components/wwlln/translations/de.json | 17 -- .../components/wwlln/translations/en.json | 17 -- .../components/wwlln/translations/es-419.json | 17 -- .../components/wwlln/translations/es.json | 17 -- .../components/wwlln/translations/fi.json | 12 - .../components/wwlln/translations/fr.json | 17 -- .../components/wwlln/translations/hr.json | 14 -- .../components/wwlln/translations/hu.json | 12 - .../components/wwlln/translations/it.json | 17 -- .../components/wwlln/translations/ko.json | 17 -- .../components/wwlln/translations/lb.json | 17 -- .../components/wwlln/translations/nl.json | 17 -- .../components/wwlln/translations/no.json | 17 -- .../components/wwlln/translations/pl.json | 17 -- .../components/wwlln/translations/pt-BR.json | 17 -- .../components/wwlln/translations/pt.json | 12 - .../components/wwlln/translations/ru.json | 17 -- .../components/wwlln/translations/sl.json | 17 -- .../components/wwlln/translations/sv.json | 14 -- .../wwlln/translations/zh-Hans.json | 14 -- .../wwlln/translations/zh-Hant.json | 17 -- homeassistant/generated/config_flows.py | 1 - requirements_all.txt | 3 - requirements_test_all.txt | 3 - tests/components/wwlln/__init__.py | 1 - tests/components/wwlln/conftest.py | 28 --- tests/components/wwlln/test_config_flow.py | 135 ----------- 39 files changed, 1000 deletions(-) delete mode 100644 homeassistant/components/wwlln/__init__.py delete mode 100644 homeassistant/components/wwlln/config_flow.py delete mode 100644 homeassistant/components/wwlln/const.py delete mode 100644 homeassistant/components/wwlln/geo_location.py delete mode 100644 homeassistant/components/wwlln/manifest.json delete mode 100644 homeassistant/components/wwlln/strings.json delete mode 100644 homeassistant/components/wwlln/translations/bg.json delete mode 100644 homeassistant/components/wwlln/translations/ca.json delete mode 100644 homeassistant/components/wwlln/translations/cy.json delete mode 100644 homeassistant/components/wwlln/translations/da.json delete mode 100644 homeassistant/components/wwlln/translations/de.json delete mode 100644 homeassistant/components/wwlln/translations/en.json delete mode 100644 homeassistant/components/wwlln/translations/es-419.json delete mode 100644 homeassistant/components/wwlln/translations/es.json delete mode 100644 homeassistant/components/wwlln/translations/fi.json delete mode 100644 homeassistant/components/wwlln/translations/fr.json delete mode 100644 homeassistant/components/wwlln/translations/hr.json delete mode 100644 homeassistant/components/wwlln/translations/hu.json delete mode 100644 homeassistant/components/wwlln/translations/it.json delete mode 100644 homeassistant/components/wwlln/translations/ko.json delete mode 100644 homeassistant/components/wwlln/translations/lb.json delete mode 100644 homeassistant/components/wwlln/translations/nl.json delete mode 100644 homeassistant/components/wwlln/translations/no.json delete mode 100644 homeassistant/components/wwlln/translations/pl.json delete mode 100644 homeassistant/components/wwlln/translations/pt-BR.json delete mode 100644 homeassistant/components/wwlln/translations/pt.json delete mode 100644 homeassistant/components/wwlln/translations/ru.json delete mode 100644 homeassistant/components/wwlln/translations/sl.json delete mode 100644 homeassistant/components/wwlln/translations/sv.json delete mode 100644 homeassistant/components/wwlln/translations/zh-Hans.json delete mode 100644 homeassistant/components/wwlln/translations/zh-Hant.json delete mode 100644 tests/components/wwlln/__init__.py delete mode 100644 tests/components/wwlln/conftest.py delete mode 100644 tests/components/wwlln/test_config_flow.py diff --git a/.coveragerc b/.coveragerc index 92c6cdbcfbc..c99b29cd719 100644 --- a/.coveragerc +++ b/.coveragerc @@ -880,8 +880,6 @@ omit = homeassistant/components/worldtidesinfo/sensor.py homeassistant/components/worxlandroid/sensor.py homeassistant/components/wunderlist/* - homeassistant/components/wwlln/__init__.py - homeassistant/components/wwlln/geo_location.py homeassistant/components/x10/light.py homeassistant/components/xbox_live/sensor.py homeassistant/components/xeoma/camera.py diff --git a/CODEOWNERS b/CODEOWNERS index a8aea5f4727..a0ccec81579 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -458,7 +458,6 @@ homeassistant/components/withings/* @vangorra homeassistant/components/wled/* @frenck homeassistant/components/workday/* @fabaff homeassistant/components/worldclock/* @fabaff -homeassistant/components/wwlln/* @bachya homeassistant/components/xbox_live/* @MartinHjelmare homeassistant/components/xfinity/* @cisasteelersfan homeassistant/components/xiaomi_aqara/* @danielhiversen @syssi diff --git a/homeassistant/components/wwlln/__init__.py b/homeassistant/components/wwlln/__init__.py deleted file mode 100644 index d83e19bd391..00000000000 --- a/homeassistant/components/wwlln/__init__.py +++ /dev/null @@ -1,102 +0,0 @@ -"""Support for World Wide Lightning Location Network.""" -import logging - -from aiowwlln import Client -import voluptuous as vol - -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS -from homeassistant.helpers import aiohttp_client, config_validation as cv - -from .const import CONF_WINDOW, DATA_CLIENT, DEFAULT_RADIUS, DEFAULT_WINDOW, DOMAIN - -_LOGGER = logging.getLogger(__name__) - -CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Optional(CONF_LATITUDE): cv.latitude, - vol.Optional(CONF_LONGITUDE): cv.longitude, - vol.Optional(CONF_RADIUS, default=DEFAULT_RADIUS): cv.positive_int, - vol.Optional(CONF_WINDOW, default=DEFAULT_WINDOW): vol.All( - cv.time_period, - cv.positive_timedelta, - lambda value: value.total_seconds(), - vol.Range(min=DEFAULT_WINDOW.total_seconds()), - ), - } - ) - }, - extra=vol.ALLOW_EXTRA, -) - - -async def async_setup(hass, config): - """Set up the WWLLN component.""" - if DOMAIN not in config: - return True - - conf = config[DOMAIN] - - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=conf - ) - ) - - return True - - -async def async_setup_entry(hass, config_entry): - """Set up the WWLLN as config entry.""" - if not config_entry.unique_id: - hass.config_entries.async_update_entry( - config_entry, - unique_id=( - f"{config_entry.data[CONF_LATITUDE]}, " - f"{config_entry.data[CONF_LONGITUDE]}" - ), - ) - - hass.data[DOMAIN] = {} - hass.data[DOMAIN][DATA_CLIENT] = {} - - websession = aiohttp_client.async_get_clientsession(hass) - - hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id] = Client(websession) - - hass.async_create_task( - hass.config_entries.async_forward_entry_setup(config_entry, "geo_location") - ) - - return True - - -async def async_unload_entry(hass, config_entry): - """Unload an WWLLN config entry.""" - hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id) - - await hass.config_entries.async_forward_entry_unload(config_entry, "geo_location") - - return True - - -async def async_migrate_entry(hass, config_entry): - """Migrate the config entry upon new versions.""" - version = config_entry.version - data = config_entry.data - - default_total_seconds = DEFAULT_WINDOW.total_seconds() - - _LOGGER.debug("Migrating from version %s", version) - - # 1 -> 2: Expanding the default window to 1 hour (if needed): - if version == 1: - if data[CONF_WINDOW] < default_total_seconds: - data[CONF_WINDOW] = default_total_seconds - version = config_entry.version = 2 - hass.config_entries.async_update_entry(config_entry, data=data) - _LOGGER.info("Migration to version %s successful", version) - - return True diff --git a/homeassistant/components/wwlln/config_flow.py b/homeassistant/components/wwlln/config_flow.py deleted file mode 100644 index 4ec7c2a9a0c..00000000000 --- a/homeassistant/components/wwlln/config_flow.py +++ /dev/null @@ -1,70 +0,0 @@ -"""Config flow to configure the WWLLN integration.""" -import voluptuous as vol - -from homeassistant import config_entries -from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS -from homeassistant.helpers import config_validation as cv - -from .const import ( # pylint: disable=unused-import - CONF_WINDOW, - DEFAULT_RADIUS, - DEFAULT_WINDOW, - DOMAIN, -) - - -class WWLLNFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): - """Handle a WWLLN config flow.""" - - VERSION = 2 - CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL - - @property - def data_schema(self): - """Return the data schema for the user form.""" - return vol.Schema( - { - vol.Optional( - CONF_LATITUDE, default=self.hass.config.latitude - ): cv.latitude, - vol.Optional( - CONF_LONGITUDE, default=self.hass.config.longitude - ): cv.longitude, - vol.Optional(CONF_RADIUS, default=DEFAULT_RADIUS): cv.positive_int, - } - ) - - async def _show_form(self, errors=None): - """Show the form to the user.""" - return self.async_show_form( - step_id="user", data_schema=self.data_schema, errors=errors or {} - ) - - async def async_step_import(self, import_config): - """Import a config entry from configuration.yaml.""" - return await self.async_step_user(import_config) - - async def async_step_user(self, user_input=None): - """Handle the start of the config flow.""" - if not user_input: - return await self._show_form() - - latitude = user_input.get(CONF_LATITUDE, self.hass.config.latitude) - longitude = user_input.get(CONF_LONGITUDE, self.hass.config.longitude) - - identifier = f"{latitude}, {longitude}" - - await self.async_set_unique_id(identifier) - self._abort_if_unique_id_configured() - - return self.async_create_entry( - title=identifier, - data={ - CONF_LATITUDE: latitude, - CONF_LONGITUDE: longitude, - CONF_RADIUS: user_input.get(CONF_RADIUS, DEFAULT_RADIUS), - CONF_WINDOW: user_input.get( - CONF_WINDOW, DEFAULT_WINDOW.total_seconds() - ), - }, - ) diff --git a/homeassistant/components/wwlln/const.py b/homeassistant/components/wwlln/const.py deleted file mode 100644 index 141baf38cda..00000000000 --- a/homeassistant/components/wwlln/const.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Define constants for the WWLLN integration.""" -from datetime import timedelta - -DOMAIN = "wwlln" - -CONF_WINDOW = "window" - -DATA_CLIENT = "client" - -DEFAULT_RADIUS = 25 -DEFAULT_WINDOW = timedelta(hours=1) diff --git a/homeassistant/components/wwlln/geo_location.py b/homeassistant/components/wwlln/geo_location.py deleted file mode 100644 index ed4d4fcd6b8..00000000000 --- a/homeassistant/components/wwlln/geo_location.py +++ /dev/null @@ -1,228 +0,0 @@ -"""Support for WWLLN geo location events.""" -from datetime import timedelta -import logging - -from aiowwlln.errors import WWLLNError - -from homeassistant.components.geo_location import GeolocationEvent -from homeassistant.const import ( - ATTR_ATTRIBUTION, - CONF_LATITUDE, - CONF_LONGITUDE, - CONF_RADIUS, - CONF_UNIT_SYSTEM_IMPERIAL, - LENGTH_KILOMETERS, - LENGTH_MILES, -) -from homeassistant.core import callback -from homeassistant.helpers.dispatcher import ( - async_dispatcher_connect, - async_dispatcher_send, -) -from homeassistant.helpers.event import async_track_time_interval -from homeassistant.util.dt import utc_from_timestamp - -from .const import CONF_WINDOW, DATA_CLIENT, DOMAIN - -_LOGGER = logging.getLogger(__name__) - -ATTR_EXTERNAL_ID = "external_id" -ATTR_PUBLICATION_DATE = "publication_date" - -DEFAULT_ATTRIBUTION = "Data provided by the WWLLN" -DEFAULT_EVENT_NAME = "Lightning Strike: {0}" -DEFAULT_ICON = "mdi:flash" -DEFAULT_UPDATE_INTERVAL = timedelta(minutes=10) - -SIGNAL_DELETE_ENTITY = "wwlln_delete_entity_{0}" - - -async def async_setup_entry(hass, entry, async_add_entities): - """Set up WWLLN based on a config entry.""" - client = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id] - manager = WWLLNEventManager( - hass, - async_add_entities, - client, - entry.data[CONF_LATITUDE], - entry.data[CONF_LONGITUDE], - entry.data[CONF_RADIUS], - entry.data[CONF_WINDOW], - ) - await manager.async_init() - - -class WWLLNEventManager: - """Define a class to handle WWLLN events.""" - - def __init__( - self, - hass, - async_add_entities, - client, - latitude, - longitude, - radius, - window_seconds, - ): - """Initialize.""" - self._async_add_entities = async_add_entities - self._client = client - self._hass = hass - self._latitude = latitude - self._longitude = longitude - self._managed_strike_ids = set() - self._radius = radius - self._strikes = {} - self._window = timedelta(seconds=window_seconds) - - if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL: - self._unit = LENGTH_MILES - else: - self._unit = LENGTH_KILOMETERS - - @callback - def _create_events(self, ids_to_create): - """Create new geo location events.""" - _LOGGER.debug("Going to create %s", ids_to_create) - events = [] - for strike_id in ids_to_create: - strike = self._strikes[strike_id] - event = WWLLNEvent( - strike["distance"], - strike["lat"], - strike["long"], - self._unit, - strike_id, - strike["unixTime"], - ) - events.append(event) - - self._async_add_entities(events) - - @callback - def _remove_events(self, ids_to_remove): - """Remove old geo location events.""" - _LOGGER.debug("Going to remove %s", ids_to_remove) - for strike_id in ids_to_remove: - async_dispatcher_send(self._hass, SIGNAL_DELETE_ENTITY.format(strike_id)) - - async def async_init(self): - """Schedule regular updates based on configured time interval.""" - - async def update(event_time): - """Update.""" - await self.async_update() - - await self.async_update() - async_track_time_interval(self._hass, update, DEFAULT_UPDATE_INTERVAL) - - async def async_update(self): - """Refresh data.""" - _LOGGER.debug("Refreshing WWLLN data") - - try: - self._strikes = await self._client.within_radius( - self._latitude, - self._longitude, - self._radius, - unit=self._hass.config.units.name, - window=self._window, - ) - except WWLLNError as err: - _LOGGER.error("Error while updating WWLLN data: %s", err) - return - - new_strike_ids = set(self._strikes) - # Remove all managed entities that are not in the latest update anymore. - ids_to_remove = self._managed_strike_ids.difference(new_strike_ids) - self._remove_events(ids_to_remove) - - # Create new entities for all strikes that are not managed entities yet. - ids_to_create = new_strike_ids.difference(self._managed_strike_ids) - self._create_events(ids_to_create) - - # Store all external IDs of all managed strikes. - self._managed_strike_ids = new_strike_ids - - -class WWLLNEvent(GeolocationEvent): - """Define a lightning strike event.""" - - def __init__( - self, distance, latitude, longitude, unit, strike_id, publication_date - ): - """Initialize entity with data provided.""" - self._distance = distance - self._latitude = latitude - self._longitude = longitude - self._publication_date = publication_date - self._remove_signal_delete = None - self._strike_id = strike_id - self._unit_of_measurement = unit - - @property - def device_state_attributes(self): - """Return the device state attributes.""" - attributes = {} - for key, value in ( - (ATTR_EXTERNAL_ID, self._strike_id), - (ATTR_ATTRIBUTION, DEFAULT_ATTRIBUTION), - (ATTR_PUBLICATION_DATE, utc_from_timestamp(self._publication_date)), - ): - attributes[key] = value - return attributes - - @property - def distance(self): - """Return distance value of this external event.""" - return self._distance - - @property - def icon(self): - """Return the icon to use in the front-end.""" - return DEFAULT_ICON - - @property - def latitude(self): - """Return latitude value of this external event.""" - return self._latitude - - @property - def longitude(self): - """Return longitude value of this external event.""" - return self._longitude - - @property - def name(self): - """Return the name of the event.""" - return DEFAULT_EVENT_NAME.format(self._strike_id) - - @property - def source(self) -> str: - """Return source value of this external event.""" - return DOMAIN - - @property - def should_poll(self): - """Disable polling.""" - return False - - @property - def unit_of_measurement(self): - """Return the unit of measurement.""" - return self._unit_of_measurement - - @callback - def _delete_callback(self): - """Remove this entity.""" - self._remove_signal_delete() - self.hass.async_create_task(self.async_remove()) - - async def async_added_to_hass(self): - """Call when entity is added to hass.""" - self._remove_signal_delete = async_dispatcher_connect( - self.hass, - SIGNAL_DELETE_ENTITY.format(self._strike_id), - self._delete_callback, - ) diff --git a/homeassistant/components/wwlln/manifest.json b/homeassistant/components/wwlln/manifest.json deleted file mode 100644 index 19406ac4b7a..00000000000 --- a/homeassistant/components/wwlln/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "domain": "wwlln", - "name": "World Wide Lightning Location Network (WWLLN)", - "config_flow": true, - "documentation": "https://www.home-assistant.io/integrations/wwlln", - "requirements": ["aiowwlln==2.0.2"], - "codeowners": ["@bachya"] -} diff --git a/homeassistant/components/wwlln/strings.json b/homeassistant/components/wwlln/strings.json deleted file mode 100644 index c3c9193df33..00000000000 --- a/homeassistant/components/wwlln/strings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Fill in your location information.", - "data": { - "latitude": "Latitude", - "longitude": "Longitude", - "radius": "Radius (using your base unit system)" - } - } - }, - "abort": { "already_configured": "This location is already registered." } - } -} diff --git a/homeassistant/components/wwlln/translations/bg.json b/homeassistant/components/wwlln/translations/bg.json deleted file mode 100644 index cd39935f171..00000000000 --- a/homeassistant/components/wwlln/translations/bg.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "\u0413\u0435\u043e\u0433\u0440\u0430\u0444\u0441\u043a\u0430 \u0448\u0438\u0440\u0438\u043d\u0430", - "longitude": "\u0413\u0435\u043e\u0433\u0440\u0430\u0444\u0441\u043a\u0430 \u0434\u044a\u043b\u0436\u0438\u043d\u0430", - "radius": "\u0420\u0430\u0434\u0438\u0443\u0441 (\u0438\u0437\u043f\u043e\u043b\u0437\u0432\u0430\u0439\u043a\u0438 \u0438\u0437\u0431\u0440\u0430\u043d\u0430\u0442\u0430 \u043e\u0442 \u0412\u0430\u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0442 \u043c\u0435\u0440\u043d\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u0438)" - }, - "title": "\u041f\u043e\u043f\u044a\u043b\u043d\u0435\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f\u0442\u0430 \u0437\u0430 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u0442\u043e \u0441\u0438." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/ca.json b/homeassistant/components/wwlln/translations/ca.json deleted file mode 100644 index b6e915aa35e..00000000000 --- a/homeassistant/components/wwlln/translations/ca.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Aquesta ubicaci\u00f3 ja est\u00e0 registrada." - }, - "step": { - "user": { - "data": { - "latitude": "Latitud", - "longitude": "Longitud", - "radius": "Radi (utilitzant el sistema d'unitats establert)" - }, - "title": "Introdueix la teva informaci\u00f3 d'ubicaci\u00f3." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/cy.json b/homeassistant/components/wwlln/translations/cy.json deleted file mode 100644 index f9c36f4e72a..00000000000 --- a/homeassistant/components/wwlln/translations/cy.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Lledred", - "longitude": "Hydred", - "radius": "Radiws (gan ddefnyddio'ch system uned sylfaenol)" - }, - "title": "Cwblhewch gwybodaeth eich lleoliad" - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/da.json b/homeassistant/components/wwlln/translations/da.json deleted file mode 100644 index b87d9af14f3..00000000000 --- a/homeassistant/components/wwlln/translations/da.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Breddegrad", - "longitude": "L\u00e6ngdegrad", - "radius": "Radius (ved hj\u00e6lp af dit basisenhedssystem)" - }, - "title": "Udfyld dine lokalitetsoplysninger." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/de.json b/homeassistant/components/wwlln/translations/de.json deleted file mode 100644 index 2f59ea2d38c..00000000000 --- a/homeassistant/components/wwlln/translations/de.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Dieser Standort ist bereits registriert." - }, - "step": { - "user": { - "data": { - "latitude": "Breitengrad", - "longitude": "L\u00e4ngengrad", - "radius": "Radius (mit Ma\u00dfeinheit)" - }, - "title": "Gib deine Standortinformationen ein." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/en.json b/homeassistant/components/wwlln/translations/en.json deleted file mode 100644 index 936c64c2a77..00000000000 --- a/homeassistant/components/wwlln/translations/en.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "This location is already registered." - }, - "step": { - "user": { - "data": { - "latitude": "Latitude", - "longitude": "Longitude", - "radius": "Radius (using your base unit system)" - }, - "title": "Fill in your location information." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/es-419.json b/homeassistant/components/wwlln/translations/es-419.json deleted file mode 100644 index 11ae8c64359..00000000000 --- a/homeassistant/components/wwlln/translations/es-419.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Esta ubicaci\u00f3n ya est\u00e1 registrada." - }, - "step": { - "user": { - "data": { - "latitude": "Latitud", - "longitude": "Longitud", - "radius": "Radio (usando su sistema de unidad base)" - }, - "title": "Complete su informaci\u00f3n de ubicaci\u00f3n." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/es.json b/homeassistant/components/wwlln/translations/es.json deleted file mode 100644 index 16b3b461ad1..00000000000 --- a/homeassistant/components/wwlln/translations/es.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Esta ubicaci\u00f3n ya est\u00e1 registrada." - }, - "step": { - "user": { - "data": { - "latitude": "Latitud", - "longitude": "Longitud", - "radius": "Radio (usando la unidad base del sistema)" - }, - "title": "Completa la informaci\u00f3n de tu ubicaci\u00f3n." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/fi.json b/homeassistant/components/wwlln/translations/fi.json deleted file mode 100644 index 1b1b454585f..00000000000 --- a/homeassistant/components/wwlln/translations/fi.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Leveysaste", - "longitude": "Pituusaste" - } - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/fr.json b/homeassistant/components/wwlln/translations/fr.json deleted file mode 100644 index d4fad7f0160..00000000000 --- a/homeassistant/components/wwlln/translations/fr.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Cet emplacement est d\u00e9j\u00e0 enregistr\u00e9." - }, - "step": { - "user": { - "data": { - "latitude": "Latitude", - "longitude": "Longitude", - "radius": "Rayon (en utilisant votre syst\u00e8me d'unit\u00e9 de base)" - }, - "title": "Veuillez saisir vos informations d'emplacement." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/hr.json b/homeassistant/components/wwlln/translations/hr.json deleted file mode 100644 index 43af25b9047..00000000000 --- a/homeassistant/components/wwlln/translations/hr.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Zemljopisna \u0161irina", - "longitude": "Zemljopisna du\u017eina", - "radius": "Radius (koriste\u0107i sustav osnovne jedinice)" - }, - "title": "Ispunite podatke o lokaciji." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/hu.json b/homeassistant/components/wwlln/translations/hu.json deleted file mode 100644 index 740fc1a8179..00000000000 --- a/homeassistant/components/wwlln/translations/hu.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Sz\u00e9less\u00e9g", - "longitude": "Hossz\u00fas\u00e1g" - } - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/it.json b/homeassistant/components/wwlln/translations/it.json deleted file mode 100644 index 4193ccab890..00000000000 --- a/homeassistant/components/wwlln/translations/it.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Questa posizione \u00e8 gi\u00e0 registrata." - }, - "step": { - "user": { - "data": { - "latitude": "Latitudine", - "longitude": "Longitudine", - "radius": "Raggio (utilizzando il tuo sistema di unit\u00e0 di misura di base)" - }, - "title": "Inserisci le informazioni sulla tua posizione." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/ko.json b/homeassistant/components/wwlln/translations/ko.json deleted file mode 100644 index 5ddf4f05184..00000000000 --- a/homeassistant/components/wwlln/translations/ko.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "\uc774 \uc704\uce58\ub294 \uc774\ubbf8 \ub4f1\ub85d\ub418\uc5c8\uc2b5\ub2c8\ub2e4" - }, - "step": { - "user": { - "data": { - "latitude": "\uc704\ub3c4", - "longitude": "\uacbd\ub3c4", - "radius": "\ubc18\uacbd (\uae30\ubcf8 \ub2e8\uc704 \uc2dc\uc2a4\ud15c \uc0ac\uc6a9)" - }, - "title": "\uc704\uce58 \uc815\ubcf4\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/lb.json b/homeassistant/components/wwlln/translations/lb.json deleted file mode 100644 index dcdc2becf06..00000000000 --- a/homeassistant/components/wwlln/translations/lb.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "D\u00ebse Standuert ass scho registr\u00e9iert" - }, - "step": { - "user": { - "data": { - "latitude": "Breedegrad", - "longitude": "L\u00e4ngegrad", - "radius": "Radius (mat \u00e4ren Basis Unit\u00e9ite System)" - }, - "title": "F\u00ebllt \u00e4r Informatiounen aus." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/nl.json b/homeassistant/components/wwlln/translations/nl.json deleted file mode 100644 index 34388295976..00000000000 --- a/homeassistant/components/wwlln/translations/nl.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Deze locatie is al geregistreerd." - }, - "step": { - "user": { - "data": { - "latitude": "Breedtegraad", - "longitude": "Lengtegraad", - "radius": "Radius (met behulp van uw basisstation systeem)" - }, - "title": "Vul uw locatiegegevens in." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/no.json b/homeassistant/components/wwlln/translations/no.json deleted file mode 100644 index 4ce9b99b738..00000000000 --- a/homeassistant/components/wwlln/translations/no.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Denne plasseringen er allerede registrert." - }, - "step": { - "user": { - "data": { - "latitude": "Breddegrad", - "longitude": "Lengdegrad", - "radius": "Radius (ved hjelp av ditt basenhetssystem)" - }, - "title": "Fyll ut posisjonsinformasjonen din." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/pl.json b/homeassistant/components/wwlln/translations/pl.json deleted file mode 100644 index 04071c31cb1..00000000000 --- a/homeassistant/components/wwlln/translations/pl.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Ta lokalizacja jest ju\u017c zarejestrowana." - }, - "step": { - "user": { - "data": { - "latitude": "Szeroko\u015b\u0107 geograficzna", - "longitude": "D\u0142ugo\u015b\u0107 geograficzna", - "radius": "Promie\u0144 (przy u\u017cyciu systemu jednostki bazowej)" - }, - "title": "Wprowad\u017a informacje o lokalizacji." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/pt-BR.json b/homeassistant/components/wwlln/translations/pt-BR.json deleted file mode 100644 index 3c64c1534a1..00000000000 --- a/homeassistant/components/wwlln/translations/pt-BR.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Este local j\u00e1 est\u00e1 registrado." - }, - "step": { - "user": { - "data": { - "latitude": "Latitude", - "longitude": "Longitude", - "radius": "Raio (usando seu sistema de unidade base)" - }, - "title": "Preencha suas informa\u00e7\u00f5es de localiza\u00e7\u00e3o." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/pt.json b/homeassistant/components/wwlln/translations/pt.json deleted file mode 100644 index c7081cd694a..00000000000 --- a/homeassistant/components/wwlln/translations/pt.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Latitude", - "longitude": "Longitude" - } - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/ru.json b/homeassistant/components/wwlln/translations/ru.json deleted file mode 100644 index 007704bf406..00000000000 --- a/homeassistant/components/wwlln/translations/ru.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430." - }, - "step": { - "user": { - "data": { - "latitude": "\u0428\u0438\u0440\u043e\u0442\u0430", - "longitude": "\u0414\u043e\u043b\u0433\u043e\u0442\u0430", - "radius": "\u0420\u0430\u0434\u0438\u0443\u0441 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0412\u0430\u0448\u0443 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0435\u0434\u0438\u043d\u0438\u0446)" - }, - "title": "\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435" - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/sl.json b/homeassistant/components/wwlln/translations/sl.json deleted file mode 100644 index 55712fd8590..00000000000 --- a/homeassistant/components/wwlln/translations/sl.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Ta lokacija je \u017ee registrirana." - }, - "step": { - "user": { - "data": { - "latitude": "Zemljepisna \u0161irina", - "longitude": "Zemljepisna dol\u017eina", - "radius": "Obmo\u010dje (z uporabo va\u0161ih osnovnih enot)" - }, - "title": "Izpolnite podatke o va\u0161i lokaciji." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/sv.json b/homeassistant/components/wwlln/translations/sv.json deleted file mode 100644 index 22a91d7dfcc..00000000000 --- a/homeassistant/components/wwlln/translations/sv.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "Latitud", - "longitude": "Longitud", - "radius": "Radie (i basinst\u00e4llningarnas enheter)" - }, - "title": "Fyll i platsinformation." - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/zh-Hans.json b/homeassistant/components/wwlln/translations/zh-Hans.json deleted file mode 100644 index 5346a777cd6..00000000000 --- a/homeassistant/components/wwlln/translations/zh-Hans.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "latitude": "\u7eac\u5ea6", - "longitude": "\u7ecf\u5ea6", - "radius": "\u534a\u5f84\uff08\u4f7f\u7528\u57fa\u672c\u5355\u4f4d\u7cfb\u7edf\uff09" - }, - "title": "\u586b\u5199\u60a8\u7684\u4f4d\u7f6e\u4fe1\u606f\u3002" - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/wwlln/translations/zh-Hant.json b/homeassistant/components/wwlln/translations/zh-Hant.json deleted file mode 100644 index 7b4bfaa1c08..00000000000 --- a/homeassistant/components/wwlln/translations/zh-Hant.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "\u6b64\u4f4d\u7f6e\u5df2\u8a3b\u518a\u3002" - }, - "step": { - "user": { - "data": { - "latitude": "\u7def\u5ea6", - "longitude": "\u7d93\u5ea6", - "radius": "\u534a\u5f91\uff08\u4f7f\u7528\u57fa\u672c\u55ae\u4f4d\u7cfb\u7d71\uff09" - }, - "title": "\u586b\u5beb\u5ea7\u6a19\u8cc7\u8a0a\u3002" - } - } - } -} \ No newline at end of file diff --git a/homeassistant/generated/config_flows.py b/homeassistant/generated/config_flows.py index 208ea3ef07f..468fb5c200c 100644 --- a/homeassistant/generated/config_flows.py +++ b/homeassistant/generated/config_flows.py @@ -163,7 +163,6 @@ FLOWS = [ "wiffi", "withings", "wled", - "wwlln", "xiaomi_miio", "zerproc", "zha", diff --git a/requirements_all.txt b/requirements_all.txt index ecd24e3ced4..ffe18f964f5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -223,9 +223,6 @@ aioswitcher==1.2.0 # homeassistant.components.unifi aiounifi==22 -# homeassistant.components.wwlln -aiowwlln==2.0.2 - # homeassistant.components.airly airly==0.0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 693c6bdb060..b4b4146511a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -112,9 +112,6 @@ aioswitcher==1.2.0 # homeassistant.components.unifi aiounifi==22 -# homeassistant.components.wwlln -aiowwlln==2.0.2 - # homeassistant.components.airly airly==0.0.2 diff --git a/tests/components/wwlln/__init__.py b/tests/components/wwlln/__init__.py deleted file mode 100644 index c44245e5988..00000000000 --- a/tests/components/wwlln/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Define tests for the WWLLN component.""" diff --git a/tests/components/wwlln/conftest.py b/tests/components/wwlln/conftest.py deleted file mode 100644 index 787b68aebcc..00000000000 --- a/tests/components/wwlln/conftest.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Define various utilities for WWLLN tests.""" -import pytest - -from homeassistant.components.wwlln import CONF_WINDOW, DOMAIN -from homeassistant.const import ( - CONF_LATITUDE, - CONF_LONGITUDE, - CONF_RADIUS, - CONF_UNIT_SYSTEM, -) - -from tests.common import MockConfigEntry - - -@pytest.fixture -def config_entry(): - """Create a mock WWLLN config entry.""" - return MockConfigEntry( - domain=DOMAIN, - data={ - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_UNIT_SYSTEM: "metric", - CONF_WINDOW: 3600, - }, - title="39.128712, -104.9812612", - ) diff --git a/tests/components/wwlln/test_config_flow.py b/tests/components/wwlln/test_config_flow.py deleted file mode 100644 index b5d34f542e3..00000000000 --- a/tests/components/wwlln/test_config_flow.py +++ /dev/null @@ -1,135 +0,0 @@ -"""Define tests for the WWLLN config flow.""" -from homeassistant import data_entry_flow -from homeassistant.components.wwlln import ( - CONF_WINDOW, - DATA_CLIENT, - DOMAIN, - async_setup_entry, -) -from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER -from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS - -from tests.async_mock import patch -from tests.common import MockConfigEntry - - -async def test_duplicate_error(hass, config_entry): - """Test that errors are shown when duplicates are added.""" - conf = {CONF_LATITUDE: 39.128712, CONF_LONGITUDE: -104.9812612, CONF_RADIUS: 25} - - MockConfigEntry( - domain=DOMAIN, unique_id="39.128712, -104.9812612", data=conf - ).add_to_hass(hass) - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=conf - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_configured" - - -async def test_show_form(hass): - """Test that the form is served with no input.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM - assert result["step_id"] == "user" - - -async def test_step_import(hass): - """Test that the import step works.""" - conf = { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - } - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=conf - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "39.128712, -104.9812612" - assert result["data"] == { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_WINDOW: 3600.0, - } - - -async def test_step_user(hass): - """Test that the user step works.""" - conf = {CONF_LATITUDE: 39.128712, CONF_LONGITUDE: -104.9812612, CONF_RADIUS: 25} - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=conf - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "39.128712, -104.9812612" - assert result["data"] == { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_WINDOW: 3600.0, - } - - -async def test_different_unit_system(hass): - """Test that the config flow picks up the HASS unit system.""" - conf = { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - } - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=conf - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "39.128712, -104.9812612" - assert result["data"] == { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_WINDOW: 3600.0, - } - - -async def test_custom_window(hass): - """Test that a custom window is stored correctly.""" - conf = { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_WINDOW: 7200, - } - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_USER}, data=conf - ) - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "39.128712, -104.9812612" - assert result["data"] == { - CONF_LATITUDE: 39.128712, - CONF_LONGITUDE: -104.9812612, - CONF_RADIUS: 25, - CONF_WINDOW: 7200, - } - - -async def test_component_load_config_entry(hass, config_entry): - """Test that loading an existing config entry yields a client.""" - config_entry.add_to_hass(hass) - with patch.object(hass.config_entries, "async_forward_entry_setup") as forward_mock: - assert await async_setup_entry(hass, config_entry) - - await hass.async_block_till_done() - assert forward_mock.call_count == 1 - assert len(hass.data[DOMAIN][DATA_CLIENT]) == 1