diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index 528a314dd7b..1a73de885c0 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -5,7 +5,6 @@ from typing import Any, Awaitable, Callable, List, Optional, Set import voluptuous as vol -from homeassistant.components import sun from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_NAME, @@ -578,6 +577,6 @@ def _trigger_extract_entities(trigger_conf: dict) -> List[str]: return [trigger_conf[CONF_ZONE]] if trigger_conf[CONF_PLATFORM] == "sun": - return [sun.ENTITY_ID] + return ["sun.sun"] return [] diff --git a/homeassistant/components/garmin_connect/const.py b/homeassistant/components/garmin_connect/const.py index 57cd35e667f..e38bd72c1ee 100644 --- a/homeassistant/components/garmin_connect/const.py +++ b/homeassistant/components/garmin_connect/const.py @@ -27,7 +27,7 @@ GARMIN_ENTITY_LIST = { False, ], "netCalorieGoal": ["Net Calorie Goal", "cal", "mdi:food", None, False], - "totalDistanceMeters": ["Total Distance Mtr", "mtr", "mdi:walk", None, True], + "totalDistanceMeters": ["Total Distance Mtr", "m", "mdi:walk", None, True], "wellnessStartTimeLocal": [ "Wellness Start Time", "", @@ -43,7 +43,7 @@ GARMIN_ENTITY_LIST = { False, ], "wellnessDescription": ["Wellness Description", "", "mdi:clock", None, False], - "wellnessDistanceMeters": ["Wellness Distance Mtr", "mtr", "mdi:walk", None, False], + "wellnessDistanceMeters": ["Wellness Distance Mtr", "m", "mdi:walk", None, False], "wellnessActiveKilocalories": [ "Wellness Active KiloCalories", "kcal", @@ -52,16 +52,16 @@ GARMIN_ENTITY_LIST = { False, ], "wellnessKilocalories": ["Wellness KiloCalories", "kcal", "mdi:food", None, False], - "highlyActiveSeconds": ["Highly Active Time", "minutes", "mdi:fire", None, False], - "activeSeconds": ["Active Time", "minutes", "mdi:fire", None, True], - "sedentarySeconds": ["Sedentary Time", "minutes", "mdi:seat", None, True], - "sleepingSeconds": ["Sleeping Time", "minutes", "mdi:sleep", None, True], - "measurableAwakeDuration": ["Awake Duration", "minutes", "mdi:sleep", None, True], - "measurableAsleepDuration": ["Sleep Duration", "minutes", "mdi:sleep", None, True], - "floorsAscendedInMeters": ["Floors Ascended Mtr", "mtr", "mdi:stairs", None, False], + "highlyActiveSeconds": ["Highly Active Time", "min", "mdi:fire", None, False], + "activeSeconds": ["Active Time", "min", "mdi:fire", None, True], + "sedentarySeconds": ["Sedentary Time", "min", "mdi:seat", None, True], + "sleepingSeconds": ["Sleeping Time", "min", "mdi:sleep", None, True], + "measurableAwakeDuration": ["Awake Duration", "min", "mdi:sleep", None, True], + "measurableAsleepDuration": ["Sleep Duration", "min", "mdi:sleep", None, True], + "floorsAscendedInMeters": ["Floors Ascended Mtr", "m", "mdi:stairs", None, False], "floorsDescendedInMeters": [ "Floors Descended Mtr", - "mtr", + "m", "mdi:stairs", None, False, @@ -97,52 +97,46 @@ GARMIN_ENTITY_LIST = { "averageStressLevel": ["Avg Stress Level", "", "mdi:flash-alert", None, True], "maxStressLevel": ["Max Stress Level", "", "mdi:flash-alert", None, True], "stressQualifier": ["Stress Qualifier", "", "mdi:flash-alert", None, False], - "stressDuration": ["Stress Duration", "minutes", "mdi:flash-alert", None, False], + "stressDuration": ["Stress Duration", "min", "mdi:flash-alert", None, False], "restStressDuration": [ "Rest Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, ], "activityStressDuration": [ "Activity Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, ], "uncategorizedStressDuration": [ "Uncat. Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, ], "totalStressDuration": [ "Total Stress Duration", - "minutes", - "mdi:flash-alert", - None, - True, - ], - "lowStressDuration": [ - "Low Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, ], + "lowStressDuration": ["Low Stress Duration", "min", "mdi:flash-alert", None, True], "mediumStressDuration": [ "Medium Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, ], "highStressDuration": [ "High Stress Duration", - "minutes", + "min", "mdi:flash-alert", None, True, @@ -192,19 +186,19 @@ GARMIN_ENTITY_LIST = { ], "moderateIntensityMinutes": [ "Moderate Intensity", - "minutes", + "min", "mdi:flash-alert", None, False, ], "vigorousIntensityMinutes": [ "Vigorous Intensity", - "minutes", + "min", "mdi:run-fast", None, False, ], - "intensityMinutesGoal": ["Intensity Goal", "minutes", "mdi:run-fast", None, False], + "intensityMinutesGoal": ["Intensity Goal", "min", "mdi:run-fast", None, False], "bodyBatteryChargedValue": [ "Body Battery Charged", "%", diff --git a/homeassistant/components/garmin_connect/sensor.py b/homeassistant/components/garmin_connect/sensor.py index 6a3128cae01..154f7010db4 100644 --- a/homeassistant/components/garmin_connect/sensor.py +++ b/homeassistant/components/garmin_connect/sensor.py @@ -165,9 +165,9 @@ class GarminConnectSensor(Entity): return data = self._data.data - if "Duration" in self._type: + if "Duration" in self._type and data[self._type]: self._state = data[self._type] // 60 - elif "Seconds" in self._type: + elif "Seconds" in self._type and data[self._type]: self._state = data[self._type] // 60 else: self._state = data[self._type] diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index 1b8cb658c28..1d54f972907 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -510,7 +510,7 @@ async def async_migrate_entry(hass: HomeAssistantType, config_entry: ConfigEntry """Migrate config entry to new version.""" if config_entry.version == 1: options = config_entry.options - recipient = options[CONF_RECIPIENT] + recipient = options.get(CONF_RECIPIENT) if isinstance(recipient, str): options[CONF_RECIPIENT] = [x.strip() for x in recipient.split(",")] config_entry.version = 2 diff --git a/homeassistant/components/icloud/account.py b/homeassistant/components/icloud/account.py index af7963d8dc1..5d681539668 100644 --- a/homeassistant/components/icloud/account.py +++ b/homeassistant/components/icloud/account.py @@ -26,6 +26,7 @@ from .const import ( DEVICE_DISPLAY_NAME, DEVICE_ID, DEVICE_LOCATION, + DEVICE_LOCATION_HORIZONTAL_ACCURACY, DEVICE_LOCATION_LATITUDE, DEVICE_LOCATION_LONGITUDE, DEVICE_LOST_MODE_CAPABLE, @@ -175,8 +176,9 @@ class IcloudAccount: def _determine_interval(self) -> int: """Calculate new interval between two API fetch (in minutes).""" - intervals = {} + intervals = {"default": self._max_interval} for device in self._devices.values(): + # Max interval if no location if device.location is None: continue @@ -186,10 +188,11 @@ class IcloudAccount: self.hass, device.location[DEVICE_LOCATION_LATITUDE], device.location[DEVICE_LOCATION_LONGITUDE], + device.location[DEVICE_LOCATION_HORIZONTAL_ACCURACY], ).result() + # Max interval if in zone if current_zone is not None: - intervals[device.name] = self._max_interval continue zones = ( @@ -209,6 +212,7 @@ class IcloudAccount: ) distances.append(round(zone_distance / 1000, 1)) + # Max interval if no zone if not distances: continue mindistance = min(distances) diff --git a/homeassistant/components/mqtt/services.yaml b/homeassistant/components/mqtt/services.yaml index 77b3e3b27a1..2af3c22fe50 100644 --- a/homeassistant/components/mqtt/services.yaml +++ b/homeassistant/components/mqtt/services.yaml @@ -30,7 +30,7 @@ dump: fields: topic: description: topic to listen to - example: "openzwave/#" + example: "OpenZWave/#" duration: description: how long we should listen for messages in seconds example: 5 diff --git a/homeassistant/components/netatmo/__init__.py b/homeassistant/components/netatmo/__init__.py index ace12d3838c..bd79f597b5b 100644 --- a/homeassistant/components/netatmo/__init__.py +++ b/homeassistant/components/netatmo/__init__.py @@ -5,7 +5,12 @@ import logging import voluptuous as vol from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET +from homeassistant.const import ( + CONF_CLIENT_ID, + CONF_CLIENT_SECRET, + CONF_DISCOVERY, + CONF_USERNAME, +) from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv @@ -14,12 +19,19 @@ from .const import AUTH, DATA_PERSONS, DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN _LOGGER = logging.getLogger(__name__) +CONF_SECRET_KEY = "secret_key" +CONF_WEBHOOKS = "webhooks" + CONFIG_SCHEMA = vol.Schema( { DOMAIN: vol.Schema( { vol.Required(CONF_CLIENT_ID): cv.string, vol.Required(CONF_CLIENT_SECRET): cv.string, + cv.deprecated(CONF_SECRET_KEY): cv.match_all, + cv.deprecated(CONF_USERNAME): cv.match_all, + cv.deprecated(CONF_WEBHOOKS): cv.match_all, + cv.deprecated(CONF_DISCOVERY): cv.match_all, } ) }, diff --git a/homeassistant/components/netatmo/config_flow.py b/homeassistant/components/netatmo/config_flow.py index 8f59382dd46..dce87fb7931 100644 --- a/homeassistant/components/netatmo/config_flow.py +++ b/homeassistant/components/netatmo/config_flow.py @@ -25,24 +25,22 @@ class NetatmoFlowHandler( @property def extra_authorize_data(self) -> dict: """Extra data that needs to be appended to the authorize url.""" - return { - "scope": ( - " ".join( - [ - "read_station", - "read_camera", - "access_camera", - "write_camera", - "read_presence", - "access_presence", - "read_homecoach", - "read_smokedetector", - "read_thermostat", - "write_thermostat", - ] - ) - ) - } + scopes = [ + "read_camera", + "read_homecoach", + "read_presence", + "read_smokedetector", + "read_station", + "read_thermostat", + "write_camera", + "write_thermostat", + ] + + if self.flow_impl.name != "Home Assistant Cloud": + scopes.extend(["access_camera", "access_presence"]) + scopes.sort() + + return {"scope": " ".join(scopes)} async def async_step_user(self, user_input=None): """Handle a flow start.""" diff --git a/homeassistant/components/webostv/manifest.json b/homeassistant/components/webostv/manifest.json index e55867432cc..acdee1d9ca9 100644 --- a/homeassistant/components/webostv/manifest.json +++ b/homeassistant/components/webostv/manifest.json @@ -2,7 +2,7 @@ "domain": "webostv", "name": "LG webOS Smart TV", "documentation": "https://www.home-assistant.io/integrations/webostv", - "requirements": ["aiopylgtv==0.3.2"], + "requirements": ["aiopylgtv==0.3.3"], "dependencies": ["configurator"], "codeowners": ["@bendavid"] } diff --git a/homeassistant/components/zone/__init__.py b/homeassistant/components/zone/__init__.py index 91a1338b671..33ac15853f4 100644 --- a/homeassistant/components/zone/__init__.py +++ b/homeassistant/components/zone/__init__.py @@ -228,7 +228,7 @@ async def async_setup(hass: HomeAssistant, config: Dict) -> bool: conf = await component.async_prepare_reload(skip_reset=True) if conf is None: return - await yaml_collection.async_load(conf[DOMAIN]) + await yaml_collection.async_load(conf.get(DOMAIN, [])) service.async_register_admin_service( hass, diff --git a/homeassistant/const.py b/homeassistant/const.py index 7d2513f3cae..c2d59eb2833 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 105 -PATCH_VERSION = "1" +PATCH_VERSION = "2" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 0) diff --git a/requirements_all.txt b/requirements_all.txt index 2e32aee8db0..627481a8d40 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -190,7 +190,7 @@ aionotion==1.1.0 aiopvapi==1.6.14 # homeassistant.components.webostv -aiopylgtv==0.3.2 +aiopylgtv==0.3.3 # homeassistant.components.switcher_kis aioswitcher==2019.4.26 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e2ac2d07cd6..c974743c516 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -69,7 +69,7 @@ aiohue==1.10.1 aionotion==1.1.0 # homeassistant.components.webostv -aiopylgtv==0.3.2 +aiopylgtv==0.3.3 # homeassistant.components.switcher_kis aioswitcher==2019.4.26 diff --git a/tests/components/netatmo/test_config_flow.py b/tests/components/netatmo/test_config_flow.py index 24aac6dc878..d76578d277c 100644 --- a/tests/components/netatmo/test_config_flow.py +++ b/tests/components/netatmo/test_config_flow.py @@ -54,15 +54,15 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock): scope = "+".join( [ - "read_station", - "read_camera", "access_camera", - "write_camera", - "read_presence", "access_presence", + "read_camera", "read_homecoach", + "read_presence", "read_smokedetector", + "read_station", "read_thermostat", + "write_camera", "write_thermostat", ] )