Compare commits

..

5 Commits

Author SHA1 Message Date
Paulus Schoutsen
c02be99ab7 Bumped version to 1.0.0b6 2020-12-12 20:35:58 +00:00
Bram Kragten
7c2a2b08c7 Updated frontend to 20201212.0 (#44154) 2020-12-12 20:35:52 +00:00
Steven Looman
f858d6f9ec Fix upnp first discovered device is used (#44151)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-12-12 20:35:50 +00:00
Aaron Bach
8507b62016 Fix inability to erase SimpliSafe code (#44137) 2020-12-12 20:35:49 +00:00
Brian Rogers
8c6636994f Fix Met.no forecast precipitation (#44106) 2020-12-12 20:35:47 +00:00
10 changed files with 53 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
"domain": "frontend",
"name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/integrations/frontend",
"requirements": ["home-assistant-frontend==20201210.0"],
"requirements": ["home-assistant-frontend==20201212.0"],
"dependencies": [
"api",
"auth",

View File

@@ -21,8 +21,10 @@ from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
LENGTH_INCHES,
LENGTH_KILOMETERS,
LENGTH_MILES,
LENGTH_MILLIMETERS,
PRESSURE_HPA,
PRESSURE_INHG,
TEMP_CELSIUS,
@@ -32,7 +34,14 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.util.distance import convert as convert_distance
from homeassistant.util.pressure import convert as convert_pressure
from .const import ATTR_MAP, CONDITIONS_MAP, CONF_TRACK_HOME, DOMAIN, FORECAST_MAP
from .const import (
ATTR_FORECAST_PRECIPITATION,
ATTR_MAP,
CONDITIONS_MAP,
CONF_TRACK_HOME,
DOMAIN,
FORECAST_MAP,
)
_LOGGER = logging.getLogger(__name__)
@@ -221,6 +230,14 @@ class MetWeather(CoordinatorEntity, WeatherEntity):
for k, v in FORECAST_MAP.items()
if met_item.get(v) is not None
}
if not self._is_metric:
if ATTR_FORECAST_PRECIPITATION in ha_item:
precip_inches = convert_distance(
ha_item[ATTR_FORECAST_PRECIPITATION],
LENGTH_MILLIMETERS,
LENGTH_INCHES,
)
ha_item[ATTR_FORECAST_PRECIPITATION] = round(precip_inches, 2)
if ha_item.get(ATTR_FORECAST_CONDITION):
ha_item[ATTR_FORECAST_CONDITION] = format_condition(
ha_item[ATTR_FORECAST_CONDITION]

View File

@@ -15,6 +15,15 @@ from homeassistant.helpers import aiohttp_client
from . import async_get_client_id
from .const import DOMAIN, LOGGER # pylint: disable=unused-import
FULL_DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Optional(CONF_CODE): str,
}
)
PASSWORD_DATA_SCHEMA = vol.Schema({vol.Required(CONF_PASSWORD): str})
class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a SimpliSafe config flow."""
@@ -24,15 +33,6 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
def __init__(self):
"""Initialize the config flow."""
self.full_data_schema = vol.Schema(
{
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Optional(CONF_CODE): str,
}
)
self.password_data_schema = vol.Schema({vol.Required(CONF_PASSWORD): str})
self._code = None
self._password = None
self._username = None
@@ -125,21 +125,19 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle re-auth completion."""
if not user_input:
return self.async_show_form(
step_id="reauth_confirm", data_schema=self.password_data_schema
step_id="reauth_confirm", data_schema=PASSWORD_DATA_SCHEMA
)
self._password = user_input[CONF_PASSWORD]
return await self._async_login_during_step(
step_id="reauth_confirm", form_schema=self.password_data_schema
step_id="reauth_confirm", form_schema=PASSWORD_DATA_SCHEMA
)
async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return self.async_show_form(
step_id="user", data_schema=self.full_data_schema
)
return self.async_show_form(step_id="user", data_schema=FULL_DATA_SCHEMA)
await self.async_set_unique_id(user_input[CONF_USERNAME])
self._abort_if_unique_id_configured()
@@ -149,7 +147,7 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self._username = user_input[CONF_USERNAME]
return await self._async_login_during_step(
step_id="user", form_schema=self.full_data_schema
step_id="user", form_schema=FULL_DATA_SCHEMA
)
@@ -171,7 +169,9 @@ class SimpliSafeOptionsFlowHandler(config_entries.OptionsFlow):
{
vol.Optional(
CONF_CODE,
default=self.config_entry.options.get(CONF_CODE),
description={
"suggested_value": self.config_entry.options.get(CONF_CODE)
},
): str
}
),

View File

@@ -43,6 +43,8 @@ async def async_discover_and_construct(
) -> Device:
"""Discovery devices and construct a Device for one."""
# pylint: disable=invalid-name
_LOGGER.debug("Constructing device: %s::%s", udn, st)
discovery_infos = await Device.async_discover(hass)
_LOGGER.debug("Discovered devices: %s", discovery_infos)
if not discovery_infos:
@@ -53,7 +55,7 @@ async def async_discover_and_construct(
# Get the discovery info with specified UDN/ST.
filtered = [di for di in discovery_infos if di[DISCOVERY_UDN] == udn]
if st:
filtered = [di for di in discovery_infos if di[DISCOVERY_ST] == st]
filtered = [di for di in filtered if di[DISCOVERY_ST] == st]
if not filtered:
_LOGGER.warning(
'Wanted UPnP/IGD device with UDN/ST "%s"/"%s" not found, aborting',
@@ -74,6 +76,7 @@ async def async_discover_and_construct(
)
_LOGGER.info("Detected multiple UPnP/IGD devices, using: %s", device_name)
_LOGGER.debug("Constructing from discovery_info: %s", discovery_info)
location = discovery_info[DISCOVERY_LOCATION]
return await Device.async_create_device(hass, location)
@@ -104,7 +107,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType):
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
"""Set up UPnP/IGD device from a config entry."""
_LOGGER.debug("async_setup_entry, config_entry: %s", config_entry.data)
_LOGGER.debug("Setting up config entry: %s", config_entry.unique_id)
# Discover and construct.
udn = config_entry.data.get(CONFIG_ENTRY_UDN)
@@ -123,6 +126,11 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
# Ensure entry has a unique_id.
if not config_entry.unique_id:
_LOGGER.debug(
"Setting unique_id: %s, for config_entry: %s",
device.unique_id,
config_entry,
)
hass.config_entries.async_update_entry(
entry=config_entry,
unique_id=device.unique_id,
@@ -152,6 +160,8 @@ async def async_unload_entry(
hass: HomeAssistantType, config_entry: ConfigEntry
) -> bool:
"""Unload a UPnP/IGD device from a config entry."""
_LOGGER.debug("Unloading config entry: %s", config_entry.unique_id)
udn = config_entry.data.get(CONFIG_ENTRY_UDN)
if udn in hass.data[DOMAIN][DOMAIN_DEVICES]:
del hass.data[DOMAIN][DOMAIN_DEVICES][udn]

View File

@@ -154,6 +154,7 @@ class UpnpFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self._abort_if_unique_id_configured()
# Store discovery.
_LOGGER.debug("New discovery, continuing")
name = discovery_info.get("friendlyName", "")
discovery = {
DISCOVERY_UDN: udn,

View File

@@ -109,7 +109,7 @@ class Device:
def __str__(self) -> str:
"""Get string representation."""
return f"IGD Device: {self.name}/{self.udn}"
return f"IGD Device: {self.name}/{self.udn}::{self.device_type}"
async def async_get_traffic_data(self) -> Mapping[str, any]:
"""

View File

@@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 1
MINOR_VERSION = 0
PATCH_VERSION = "0b5"
PATCH_VERSION = "0b6"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 1)

View File

@@ -13,7 +13,7 @@ defusedxml==0.6.0
distro==1.5.0
emoji==0.5.4
hass-nabucasa==0.39.0
home-assistant-frontend==20201210.0
home-assistant-frontend==20201212.0
httpx==0.16.1
importlib-metadata==1.6.0;python_version<'3.8'
jinja2>=2.11.2

View File

@@ -765,7 +765,7 @@ hole==0.5.1
holidays==0.10.3
# homeassistant.components.frontend
home-assistant-frontend==20201210.0
home-assistant-frontend==20201212.0
# homeassistant.components.zwave
homeassistant-pyozw==0.1.10

View File

@@ -394,7 +394,7 @@ hole==0.5.1
holidays==0.10.3
# homeassistant.components.frontend
home-assistant-frontend==20201210.0
home-assistant-frontend==20201212.0
# homeassistant.components.zwave
homeassistant-pyozw==0.1.10