commit
76d2658101
|
@ -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 []
|
||||
|
|
|
@ -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",
|
||||
"%",
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
},
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue