mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Remove WWLLN integration (#35926)
This commit is contained in:
parent
fa55f01c8c
commit
05cbb3f0e4
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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()
|
||||
),
|
||||
},
|
||||
)
|
@ -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)
|
@ -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,
|
||||
)
|
@ -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"]
|
||||
}
|
@ -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." }
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"latitude": "Leveysaste",
|
||||
"longitude": "Pituusaste"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"latitude": "Sz\u00e9less\u00e9g",
|
||||
"longitude": "Hossz\u00fas\u00e1g"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"latitude": "Latitude",
|
||||
"longitude": "Longitude"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"latitude": "Latitud",
|
||||
"longitude": "Longitud",
|
||||
"radius": "Radie (i basinst\u00e4llningarnas enheter)"
|
||||
},
|
||||
"title": "Fyll i platsinformation."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -163,7 +163,6 @@ FLOWS = [
|
||||
"wiffi",
|
||||
"withings",
|
||||
"wled",
|
||||
"wwlln",
|
||||
"xiaomi_miio",
|
||||
"zerproc",
|
||||
"zha",
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
"""Define tests for the WWLLN component."""
|
@ -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",
|
||||
)
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user