From 349e7b8cd178dac090e6f5a9948afef5137bcb6b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 13 Nov 2019 13:55:02 +0100 Subject: [PATCH 01/40] Bumped version to 0.102.0b0 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 449e7a90087..fa7f753495c 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0.dev0" +PATCH_VERSION = "0b0" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From 4f089aba356fbb76444622a736fc923aa7bf4fdc Mon Sep 17 00:00:00 2001 From: "David F. Mulcahey" Date: Wed, 13 Nov 2019 09:25:45 -0500 Subject: [PATCH 02/40] Bump ZHA quirks to 0.0.28 (#28750) --- homeassistant/components/zha/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/zha/manifest.json b/homeassistant/components/zha/manifest.json index 18e8af7008d..8781625d326 100644 --- a/homeassistant/components/zha/manifest.json +++ b/homeassistant/components/zha/manifest.json @@ -5,7 +5,7 @@ "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows-homeassistant==0.11.0", - "zha-quirks==0.0.27", + "zha-quirks==0.0.28", "zigpy-deconz==0.7.0", "zigpy-homeassistant==0.11.0", "zigpy-xbee-homeassistant==0.7.0", diff --git a/requirements_all.txt b/requirements_all.txt index 68ac061815d..9043f944d42 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2054,7 +2054,7 @@ zengge==0.2 zeroconf==0.23.0 # homeassistant.components.zha -zha-quirks==0.0.27 +zha-quirks==0.0.28 # homeassistant.components.zhong_hong zhong_hong_hvac==1.0.9 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f891394db6c..bd57a5490a3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -637,7 +637,7 @@ yahooweather==0.10 zeroconf==0.23.0 # homeassistant.components.zha -zha-quirks==0.0.27 +zha-quirks==0.0.28 # homeassistant.components.zha zigpy-deconz==0.7.0 From 520e4296babd17f9005843581c7a981be4fda681 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 14 Nov 2019 14:12:46 +0100 Subject: [PATCH 03/40] Updated frontend to 20191114.0 (#28768) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 8f7212209cf..b7506f599ef 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191108.0" + "home-assistant-frontend==20191114.0" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index ade3305edc9..dfe53ed2e19 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191108.0 +home-assistant-frontend==20191114.0 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 9043f944d42..058ad143f6f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191108.0 +home-assistant-frontend==20191114.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bd57a5490a3..969107d3707 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191108.0 +home-assistant-frontend==20191114.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From af2443fb10b8e028d705701eb5623a1f1b6daa86 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 14 Nov 2019 14:34:13 +0100 Subject: [PATCH 04/40] Fix account link version check (#28770) --- homeassistant/components/cloud/account_link.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/cloud/account_link.py b/homeassistant/components/cloud/account_link.py index 6fbfcc8723b..9ec1fe634d7 100644 --- a/homeassistant/components/cloud/account_link.py +++ b/homeassistant/components/cloud/account_link.py @@ -13,7 +13,6 @@ from .const import DOMAIN DATA_SERVICES = "cloud_account_link_services" CACHE_TIMEOUT = 3600 -PATCH_VERSION = int(PATCH_VERSION.split(".")[0]) _LOGGER = logging.getLogger(__name__) @@ -49,7 +48,20 @@ def _is_older(version: str) -> bool: except ValueError: return False - cur_version_parts = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION] + patch_number_str = "" + + for char in PATCH_VERSION: + if char.isnumeric(): + patch_number_str += char + else: + break + + try: + patch_number = int(patch_number_str) + except ValueError: + patch_number = 0 + + cur_version_parts = [MAJOR_VERSION, MINOR_VERSION, patch_number] return version_parts <= cur_version_parts From f5a9bcdf6d42b31db3767b2946add88333cc2bbb Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 14 Nov 2019 14:36:30 +0100 Subject: [PATCH 05/40] Bumped version to 0.102.0b1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index fa7f753495c..620af2b79db 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0b0" +PATCH_VERSION = "0b1" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From 326c25a7660ec758dc13aaafbaa0ada822f18b4c Mon Sep 17 00:00:00 2001 From: Brendon Baumgartner Date: Thu, 14 Nov 2019 12:07:43 -0800 Subject: [PATCH 06/40] Fix amazon dependency conflicts (#28217) * fix amazon dependency conflicts * bump boto3 for route53 --- homeassistant/components/amazon_polly/manifest.json | 4 ++-- homeassistant/components/aws/manifest.json | 2 +- homeassistant/components/route53/manifest.json | 2 +- requirements_all.txt | 4 ++-- requirements_test_all.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/amazon_polly/manifest.json b/homeassistant/components/amazon_polly/manifest.json index 45e382647f8..c07aad079e4 100644 --- a/homeassistant/components/amazon_polly/manifest.json +++ b/homeassistant/components/amazon_polly/manifest.json @@ -3,10 +3,10 @@ "name": "Amazon polly", "documentation": "https://www.home-assistant.io/integrations/amazon_polly", "requirements": [ - "boto3==1.9.233" + "boto3==1.9.252" ], "dependencies": [], "codeowners": [ "@robbiet480" ] -} +} \ No newline at end of file diff --git a/homeassistant/components/aws/manifest.json b/homeassistant/components/aws/manifest.json index a4543cc4b0f..b617eb75ee1 100644 --- a/homeassistant/components/aws/manifest.json +++ b/homeassistant/components/aws/manifest.json @@ -3,7 +3,7 @@ "name": "Aws", "documentation": "https://www.home-assistant.io/integrations/aws", "requirements": [ - "aiobotocore==0.10.2" + "aiobotocore==0.10.4" ], "dependencies": [], "codeowners": [ diff --git a/homeassistant/components/route53/manifest.json b/homeassistant/components/route53/manifest.json index 34a296b0f9d..307132aa01b 100644 --- a/homeassistant/components/route53/manifest.json +++ b/homeassistant/components/route53/manifest.json @@ -3,7 +3,7 @@ "name": "Route53", "documentation": "https://www.home-assistant.io/integrations/route53", "requirements": [ - "boto3==1.9.233", + "boto3==1.9.252", "ipify==1.0.0" ], "dependencies": [], diff --git a/requirements_all.txt b/requirements_all.txt index 058ad143f6f..65fe34ae7f5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -136,7 +136,7 @@ aioasuswrt==1.1.22 aioautomatic==0.6.5 # homeassistant.components.aws -aiobotocore==0.10.2 +aiobotocore==0.10.4 # homeassistant.components.dnsip aiodns==2.0.0 @@ -317,7 +317,7 @@ bomradarloop==0.1.3 # homeassistant.components.amazon_polly # homeassistant.components.route53 -boto3==1.9.233 +boto3==1.9.252 # homeassistant.components.braviatv braviarc-homeassistant==0.3.7.dev0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 969107d3707..582d0690168 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -47,7 +47,7 @@ aioasuswrt==1.1.22 aioautomatic==0.6.5 # homeassistant.components.aws -aiobotocore==0.10.2 +aiobotocore==0.10.4 # homeassistant.components.esphome aioesphomeapi==2.5.0 From 1479e7353ba24464b0d238f757f361f6acba60cf Mon Sep 17 00:00:00 2001 From: fredericvl <34839323+fredericvl@users.noreply.github.com> Date: Fri, 15 Nov 2019 09:21:46 +0100 Subject: [PATCH 07/40] Change unique id for SAJ sensor based on device SN (#28663) * Change unique id for SAJ sensor based on device SN * Add SAJ device name + sn to state attributes * Revert device state attributes (after review) --- homeassistant/components/saj/manifest.json | 2 +- homeassistant/components/saj/sensor.py | 21 +++++++++++---------- requirements_all.txt | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/saj/manifest.json b/homeassistant/components/saj/manifest.json index 4d02ab74840..02d83916d50 100644 --- a/homeassistant/components/saj/manifest.json +++ b/homeassistant/components/saj/manifest.json @@ -3,7 +3,7 @@ "name": "SAJ", "documentation": "https://www.home-assistant.io/integrations/saj", "requirements": [ - "pysaj==0.0.13" + "pysaj==0.0.14" ], "dependencies": [], "codeowners": [ diff --git a/homeassistant/components/saj/sensor.py b/homeassistant/components/saj/sensor.py index 7542440c102..2a17d110c6e 100644 --- a/homeassistant/components/saj/sensor.py +++ b/homeassistant/components/saj/sensor.py @@ -69,9 +69,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= # Use all sensors by default hass_sensors = [] - for sensor in sensor_def: - hass_sensors.append(SAJsensor(sensor, inverter_name=config.get(CONF_NAME))) - kwargs = {} if wifi: kwargs["wifi"] = True @@ -81,7 +78,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= try: saj = pysaj.SAJ(config[CONF_HOST], **kwargs) - await saj.read(sensor_def) + done = await saj.read(sensor_def) except pysaj.UnauthorizedException: _LOGGER.error("Username and/or password is wrong.") return @@ -91,7 +88,13 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) return - async_add_entities(hass_sensors) + if done: + for sensor in sensor_def: + hass_sensors.append( + SAJsensor(saj.serialnumber, sensor, inverter_name=config.get(CONF_NAME)) + ) + + async_add_entities(hass_sensors) async def async_saj(): """Update all the SAJ sensors.""" @@ -163,10 +166,11 @@ def async_track_time_interval_backoff(hass, action) -> CALLBACK_TYPE: class SAJsensor(Entity): """Representation of a SAJ sensor.""" - def __init__(self, pysaj_sensor, inverter_name=None): + def __init__(self, serialnumber, pysaj_sensor, inverter_name=None): """Initialize the sensor.""" self._sensor = pysaj_sensor self._inverter_name = inverter_name + self._serialnumber = serialnumber self._state = self._sensor.value @property @@ -235,7 +239,4 @@ class SAJsensor(Entity): @property def unique_id(self): """Return a unique identifier for this sensor.""" - if self._inverter_name: - return f"{self._inverter_name}_{self._sensor.name}" - - return f"{self._sensor.name}" + return f"{self._serialnumber}_{self._sensor.name}" diff --git a/requirements_all.txt b/requirements_all.txt index 65fe34ae7f5..eb638d9767e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1435,7 +1435,7 @@ pyrepetier==3.0.5 pysabnzbd==1.1.0 # homeassistant.components.saj -pysaj==0.0.13 +pysaj==0.0.14 # homeassistant.components.sony_projector pysdcp==1 From 5f0f5ca5574f6ec824f3191da0ff25aa14b036a1 Mon Sep 17 00:00:00 2001 From: Tyler Page Date: Fri, 15 Nov 2019 11:49:56 +0000 Subject: [PATCH 08/40] Fix changing venstar operation_mode (#28754) --- homeassistant/components/venstar/climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/venstar/climate.py b/homeassistant/components/venstar/climate.py index c948772197f..de26d236649 100644 --- a/homeassistant/components/venstar/climate.py +++ b/homeassistant/components/venstar/climate.py @@ -278,7 +278,7 @@ class VenstarThermostat(ClimateDevice): temperature = kwargs.get(ATTR_TEMPERATURE) if operation_mode and self._mode_map.get(operation_mode) != self._client.mode: - set_temp = self._set_operation_mode(self._mode_map.get(operation_mode)) + set_temp = self._set_operation_mode(operation_mode) if set_temp: if ( From fe5f30ba7887db0c2a9a53b3b28591dfcae75a79 Mon Sep 17 00:00:00 2001 From: Morten Trab Date: Sat, 16 Nov 2019 09:45:43 +0100 Subject: [PATCH 09/40] Fix Repetier integration entity indexing (#28766) * Fixed multi extruder/beds/chambers index issue, #28130 * Switched from .format to f style name formatting * Fixed incorrect indexing * Removed VS files * Removed not need temp_id subtraction * Removed VS files * Fixed access mode * Fixed access mode * Fixing access mode - again --- homeassistant/components/repetier/__init__.py | 8 ++++---- homeassistant/components/repetier/sensor.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/repetier/__init__.py b/homeassistant/components/repetier/__init__.py index 12975baca91..1d6026a8754 100644 --- a/homeassistant/components/repetier/__init__.py +++ b/homeassistant/components/repetier/__init__.py @@ -108,7 +108,7 @@ def has_all_unique_names(value): SENSOR_TYPES = { - # Type, Unit, Icon + # Type, Unit, Icon, post "bed_temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer", "_bed_"], "extruder_temperature": [ "temperature", @@ -248,12 +248,12 @@ class PrinterAPI: if prop_data is None: continue for idx, _ in enumerate(prop_data): - info["temp_id"] = idx - sensor_info.append(info) + prop_info = info.copy() + prop_info["temp_id"] = idx + sensor_info.append(prop_info) else: info["temp_id"] = None sensor_info.append(info) - self._known_entities.add(known) if not sensor_info: diff --git a/homeassistant/components/repetier/sensor.py b/homeassistant/components/repetier/sensor.py index e692ffc078f..5936b5c3343 100644 --- a/homeassistant/components/repetier/sensor.py +++ b/homeassistant/components/repetier/sensor.py @@ -35,11 +35,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None): printer_id = info["printer_id"] sensor_type = info["sensor_type"] temp_id = info["temp_id"] - name = info["name"] + name = f"{info['name']}{SENSOR_TYPES[sensor_type][3]}" if temp_id is not None: - name = "{}{}{}".format(name, SENSOR_TYPES[sensor_type][3], temp_id) - else: - name = "{}{}".format(name, SENSOR_TYPES[sensor_type][3]) + _LOGGER.debug("%s Temp_id: %s", sensor_type, temp_id) + name = f"{name}{temp_id}" sensor_class = sensor_map[sensor_type] entity = sensor_class(api, temp_id, name, printer_id, sensor_type) entities.append(entity) From 5ff24ecf77733c3bfa12c0b83629ae512762c0d8 Mon Sep 17 00:00:00 2001 From: SukramJ Date: Fri, 15 Nov 2019 09:55:40 +0100 Subject: [PATCH 10/40] Fix HomematicIP Cloud Alarm Control Panel support for basic mode (#28778) --- .../homematicip_cloud/alarm_control_panel.py | 67 +++-------------- .../test_alarm_control_panel.py | 72 +++++-------------- .../homematicip_cloud/test_climate.py | 1 + .../components/homematicip_cloud/test_init.py | 4 +- 4 files changed, 31 insertions(+), 113 deletions(-) diff --git a/homeassistant/components/homematicip_cloud/alarm_control_panel.py b/homeassistant/components/homematicip_cloud/alarm_control_panel.py index a7b1beaec93..8ebb35b12c1 100644 --- a/homeassistant/components/homematicip_cloud/alarm_control_panel.py +++ b/homeassistant/components/homematicip_cloud/alarm_control_panel.py @@ -1,8 +1,7 @@ """Support for HomematicIP Cloud alarm control panel.""" import logging -from homematicip.aio.group import AsyncSecurityZoneGroup -from homematicip.base.enums import WindowState +from homematicip.functionalHomes import SecurityAndAlarmHome from homeassistant.components.alarm_control_panel import AlarmControlPanel from homeassistant.config_entries import ConfigEntry @@ -32,34 +31,15 @@ async def async_setup_entry( ) -> None: """Set up the HomematicIP alrm control panel from a config entry.""" hap = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]] - devices = [] - security_zones = [] - for group in hap.home.groups: - if isinstance(group, AsyncSecurityZoneGroup): - security_zones.append(group) - - if security_zones: - devices.append(HomematicipAlarmControlPanel(hap, security_zones)) - - if devices: - async_add_entities(devices) + async_add_entities([HomematicipAlarmControlPanel(hap)]) class HomematicipAlarmControlPanel(AlarmControlPanel): """Representation of an alarm control panel.""" - def __init__(self, hap: HomematicipHAP, security_zones) -> None: + def __init__(self, hap: HomematicipHAP) -> None: """Initialize the alarm control panel.""" self._home = hap.home - self.alarm_state = STATE_ALARM_DISARMED - self._internal_alarm_zone = None - self._external_alarm_zone = None - - for security_zone in security_zones: - if security_zone.label == "INTERNAL": - self._internal_alarm_zone = security_zone - elif security_zone.label == "EXTERNAL": - self._external_alarm_zone = security_zone @property def device_info(self): @@ -75,28 +55,23 @@ class HomematicipAlarmControlPanel(AlarmControlPanel): @property def state(self) -> str: """Return the state of the device.""" + # check for triggered alarm + if self._security_and_alarm.alarmActive: + return STATE_ALARM_TRIGGERED + activation_state = self._home.get_security_zones_activation() # check arm_away if activation_state == (True, True): - if self._internal_alarm_zone_state or self._external_alarm_zone_state: - return STATE_ALARM_TRIGGERED return STATE_ALARM_ARMED_AWAY # check arm_home if activation_state == (False, True): - if self._external_alarm_zone_state: - return STATE_ALARM_TRIGGERED return STATE_ALARM_ARMED_HOME return STATE_ALARM_DISARMED @property - def _internal_alarm_zone_state(self) -> bool: - return _get_zone_alarm_state(self._internal_alarm_zone) - - @property - def _external_alarm_zone_state(self) -> bool: - """Return the state of the device.""" - return _get_zone_alarm_state(self._external_alarm_zone) + def _security_and_alarm(self): + return self._home.get_functionalHome(SecurityAndAlarmHome) async def async_alarm_disarm(self, code=None): """Send disarm command.""" @@ -112,10 +87,7 @@ class HomematicipAlarmControlPanel(AlarmControlPanel): async def async_added_to_hass(self): """Register callbacks.""" - if self._internal_alarm_zone: - self._internal_alarm_zone.on_update(self._async_device_changed) - if self._external_alarm_zone: - self._external_alarm_zone.on_update(self._async_device_changed) + self._home.on_update(self._async_device_changed) def _async_device_changed(self, *args, **kwargs): """Handle device state changes.""" @@ -138,26 +110,9 @@ class HomematicipAlarmControlPanel(AlarmControlPanel): @property def available(self) -> bool: """Device available.""" - return ( - not self._internal_alarm_zone.unreach - or not self._external_alarm_zone.unreach - ) + return self._home.connected @property def unique_id(self) -> str: """Return a unique ID.""" return f"{self.__class__.__name__}_{self._home.id}" - - -def _get_zone_alarm_state(security_zone) -> bool: - if security_zone and security_zone.active: - if ( - security_zone.sabotage - or security_zone.motionDetected - or security_zone.presenceDetected - or security_zone.windowState == WindowState.OPEN - or security_zone.windowState == WindowState.TILTED - ): - return True - - return False diff --git a/tests/components/homematicip_cloud/test_alarm_control_panel.py b/tests/components/homematicip_cloud/test_alarm_control_panel.py index 2798a0879b7..78bc0a09ea5 100644 --- a/tests/components/homematicip_cloud/test_alarm_control_panel.py +++ b/tests/components/homematicip_cloud/test_alarm_control_panel.py @@ -1,7 +1,4 @@ """Tests for HomematicIP Cloud alarm control panel.""" -from homematicip.base.enums import WindowState -from homematicip.group import SecurityZoneGroup - from homeassistant.components.alarm_control_panel import ( DOMAIN as ALARM_CONTROL_PANEL_DOMAIN, ) @@ -17,29 +14,24 @@ from homeassistant.setup import async_setup_component from .helper import get_and_check_entity_basics -def _get_security_zones(groups): # pylint: disable=W0221 - """Get the security zones.""" - for group in groups: - if isinstance(group, SecurityZoneGroup): - if group.label == "EXTERNAL": - external = group - elif group.label == "INTERNAL": - internal = group - return internal, external - - async def _async_manipulate_security_zones( - hass, home, internal_active, external_active, window_state + hass, home, internal_active=False, external_active=False, alarm_triggered=False ): """Set new values on hmip security zones.""" - internal_zone, external_zone = _get_security_zones(home.groups) + json = home._rawJSONData # pylint: disable=W0212 + json["functionalHomes"]["SECURITY_AND_ALARM"]["alarmActive"] = alarm_triggered + external_zone_id = json["functionalHomes"]["SECURITY_AND_ALARM"]["securityZones"][ + "EXTERNAL" + ] + internal_zone_id = json["functionalHomes"]["SECURITY_AND_ALARM"]["securityZones"][ + "INTERNAL" + ] + external_zone = home.search_group_by_id(external_zone_id) external_zone.active = external_active - external_zone.windowState = window_state + internal_zone = home.search_group_by_id(internal_zone_id) internal_zone.active = internal_active - # Just one call to a security zone is required to refresh the ACP. - internal_zone.fire_update_event() - + home.fire_update_event(json) await hass.async_block_till_done() @@ -70,79 +62,49 @@ async def test_hmip_alarm_control_panel(hass, default_mock_hap): assert not hmip_device home = default_mock_hap.home - service_call_counter = len(home.mock_calls) await hass.services.async_call( "alarm_control_panel", "alarm_arm_away", {"entity_id": entity_id}, blocking=True ) - assert len(home.mock_calls) == service_call_counter + 1 assert home.mock_calls[-1][0] == "set_security_zones_activation" assert home.mock_calls[-1][1] == (True, True) await _async_manipulate_security_zones( - hass, - home, - internal_active=True, - external_active=True, - window_state=WindowState.CLOSED, + hass, home, internal_active=True, external_active=True ) assert hass.states.get(entity_id).state is STATE_ALARM_ARMED_AWAY await hass.services.async_call( "alarm_control_panel", "alarm_arm_home", {"entity_id": entity_id}, blocking=True ) - assert len(home.mock_calls) == service_call_counter + 3 assert home.mock_calls[-1][0] == "set_security_zones_activation" assert home.mock_calls[-1][1] == (False, True) - await _async_manipulate_security_zones( - hass, - home, - internal_active=False, - external_active=True, - window_state=WindowState.CLOSED, - ) + await _async_manipulate_security_zones(hass, home, external_active=True) assert hass.states.get(entity_id).state is STATE_ALARM_ARMED_HOME await hass.services.async_call( "alarm_control_panel", "alarm_disarm", {"entity_id": entity_id}, blocking=True ) - assert len(home.mock_calls) == service_call_counter + 5 assert home.mock_calls[-1][0] == "set_security_zones_activation" assert home.mock_calls[-1][1] == (False, False) - await _async_manipulate_security_zones( - hass, - home, - internal_active=False, - external_active=False, - window_state=WindowState.CLOSED, - ) + await _async_manipulate_security_zones(hass, home) assert hass.states.get(entity_id).state is STATE_ALARM_DISARMED await hass.services.async_call( "alarm_control_panel", "alarm_arm_away", {"entity_id": entity_id}, blocking=True ) - assert len(home.mock_calls) == service_call_counter + 7 assert home.mock_calls[-1][0] == "set_security_zones_activation" assert home.mock_calls[-1][1] == (True, True) await _async_manipulate_security_zones( - hass, - home, - internal_active=True, - external_active=True, - window_state=WindowState.OPEN, + hass, home, internal_active=True, external_active=True, alarm_triggered=True ) assert hass.states.get(entity_id).state is STATE_ALARM_TRIGGERED await hass.services.async_call( "alarm_control_panel", "alarm_arm_home", {"entity_id": entity_id}, blocking=True ) - assert len(home.mock_calls) == service_call_counter + 9 assert home.mock_calls[-1][0] == "set_security_zones_activation" assert home.mock_calls[-1][1] == (False, True) await _async_manipulate_security_zones( - hass, - home, - internal_active=False, - external_active=True, - window_state=WindowState.OPEN, + hass, home, external_active=True, alarm_triggered=True ) assert hass.states.get(entity_id).state is STATE_ALARM_TRIGGERED diff --git a/tests/components/homematicip_cloud/test_climate.py b/tests/components/homematicip_cloud/test_climate.py index 858fba29563..2b233a6dee2 100644 --- a/tests/components/homematicip_cloud/test_climate.py +++ b/tests/components/homematicip_cloud/test_climate.py @@ -343,6 +343,7 @@ async def test_hmip_heating_group_heat_with_switch(hass, default_mock_hap): hass, default_mock_hap, entity_id, entity_name, device_model ) + assert hmip_device assert ha_state.state == HVAC_MODE_AUTO assert ha_state.attributes["current_temperature"] == 24.7 assert ha_state.attributes["min_temp"] == 5.0 diff --git a/tests/components/homematicip_cloud/test_init.py b/tests/components/homematicip_cloud/test_init.py index ba27a619e6a..eb51c3ece38 100644 --- a/tests/components/homematicip_cloud/test_init.py +++ b/tests/components/homematicip_cloud/test_init.py @@ -161,5 +161,5 @@ async def test_hmip_dump_hap_config_services(hass, mock_hap_with_service): ) home = mock_hap_with_service.home assert home.mock_calls[-1][0] == "download_configuration" - assert len(home.mock_calls) == 8 # pylint: disable=W0212 - assert len(write_mock.mock_calls) > 0 + assert home.mock_calls + assert write_mock.mock_calls From f8be1512b80c5dea23d1c576b25050d0b4553f1a Mon Sep 17 00:00:00 2001 From: LeoCal <25389602+LeoCal@users.noreply.github.com> Date: Fri, 15 Nov 2019 10:52:15 +0100 Subject: [PATCH 11/40] Fix Swisscom empty response received (#28782) --- homeassistant/components/swisscom/device_tracker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/swisscom/device_tracker.py b/homeassistant/components/swisscom/device_tracker.py index adb018a4b4b..5662212c9e8 100644 --- a/homeassistant/components/swisscom/device_tracker.py +++ b/homeassistant/components/swisscom/device_tracker.py @@ -92,6 +92,10 @@ class SwisscomDeviceScanner(DeviceScanner): _LOGGER.info("No response from Swisscom Internet Box") return devices + if "status" not in request.json(): + _LOGGER.info("No status in response from Swisscom Internet Box") + return devices + for device in request.json()["status"]: try: devices[device["Key"]] = { From 31cbdbf1dddc25377b8a9afe4c437539ae9d0c17 Mon Sep 17 00:00:00 2001 From: Peter Nijssen Date: Sat, 16 Nov 2019 10:37:58 +0100 Subject: [PATCH 12/40] Fix broken postnl sensor (#28794) * fix broken postnl sensor * make sure shipment list is not growing indefinitely --- homeassistant/components/postnl/manifest.json | 2 +- homeassistant/components/postnl/sensor.py | 11 ++++++++--- requirements_all.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/postnl/manifest.json b/homeassistant/components/postnl/manifest.json index d07f9746ee8..c45eea0610d 100644 --- a/homeassistant/components/postnl/manifest.json +++ b/homeassistant/components/postnl/manifest.json @@ -3,7 +3,7 @@ "name": "Postnl", "documentation": "https://www.home-assistant.io/integrations/postnl", "requirements": [ - "postnl_api==1.0.2" + "postnl_api==1.2.2" ], "dependencies": [], "codeowners": [] diff --git a/homeassistant/components/postnl/sensor.py b/homeassistant/components/postnl/sensor.py index cd190c09d87..6155f58519a 100644 --- a/homeassistant/components/postnl/sensor.py +++ b/homeassistant/components/postnl/sensor.py @@ -58,7 +58,7 @@ class PostNLSensor(Entity): def __init__(self, api, name): """Initialize the PostNL sensor.""" self._name = name - self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} + self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION, "shipments": []} self._state = None self._api = api @@ -90,6 +90,11 @@ class PostNLSensor(Entity): @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update device state.""" - shipments = self._api.get_relevant_shipments() - self._attributes["shipments"] = shipments + shipments = self._api.get_relevant_deliveries() + + self._attributes["shipments"] = [] + + for shipment in shipments: + self._attributes["shipments"].append(vars(shipment)) + self._state = len(shipments) diff --git a/requirements_all.txt b/requirements_all.txt index eb638d9767e..607574b4cfa 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -999,7 +999,7 @@ pmsensor==0.4 pocketcasts==0.1 # homeassistant.components.postnl -postnl_api==1.0.2 +postnl_api==1.2.2 # homeassistant.components.reddit praw==6.4.0 From b964fcc5b1d5e467ee81da8de0996912116dae11 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sat, 16 Nov 2019 07:22:06 +0100 Subject: [PATCH 13/40] Updated frontend to 20191115.0 (#28797) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index b7506f599ef..6c59ea38fe4 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191114.0" + "home-assistant-frontend==20191115.0" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index dfe53ed2e19..3688d6dfa38 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191114.0 +home-assistant-frontend==20191115.0 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 607574b4cfa..6f706edc740 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191114.0 +home-assistant-frontend==20191115.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 582d0690168..c42188c920f 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191114.0 +home-assistant-frontend==20191115.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From c6343c9e88ce55b719b544cb647a488849086be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Sat, 16 Nov 2019 15:05:17 +0100 Subject: [PATCH 14/40] Fix Comfoconnect errors during startup (#28802) * Add callback registrations to async_added_to_hass * Fix CODEOWNERS * Fix code formatting * Requested changes. * Don't pass unused hass and fix string formatting * Fix import order. --- CODEOWNERS | 1 + .../components/comfoconnect/__init__.py | 5 --- homeassistant/components/comfoconnect/fan.py | 35 ++++++++++-------- .../components/comfoconnect/manifest.json | 2 +- .../components/comfoconnect/sensor.py | 36 +++++++++++-------- 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 879a1c8f55d..ec92d918679 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -61,6 +61,7 @@ homeassistant/components/cisco_webex_teams/* @fbradyirl homeassistant/components/ciscospark/* @fbradyirl homeassistant/components/cloud/* @home-assistant/cloud homeassistant/components/cloudflare/* @ludeeus +homeassistant/components/comfoconnect/* @michaelarnauts homeassistant/components/config/* @home-assistant/core homeassistant/components/configurator/* @home-assistant/core homeassistant/components/conversation/* @home-assistant/core diff --git a/homeassistant/components/comfoconnect/__init__.py b/homeassistant/components/comfoconnect/__init__.py index aef4bf1deeb..efdbf020f1a 100644 --- a/homeassistant/components/comfoconnect/__init__.py +++ b/homeassistant/components/comfoconnect/__init__.py @@ -102,7 +102,6 @@ class ComfoConnectBridge: def __init__(self, hass, bridge, name, token, friendly_name, pin): """Initialize the ComfoConnect bridge.""" - self.data = {} self.name = name self.hass = hass @@ -136,7 +135,3 @@ class ComfoConnectBridge: # Notify listeners that we have received an update dispatcher_send(self.hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, var) - - def subscribe_sensor(self, sensor_id): - """Subscribe for the specified sensor.""" - self.comfoconnect.register_sensor(sensor_id) diff --git a/homeassistant/components/comfoconnect/fan.py b/homeassistant/components/comfoconnect/fan.py index bbb4b0176bf..34e784d61eb 100644 --- a/homeassistant/components/comfoconnect/fan.py +++ b/homeassistant/components/comfoconnect/fan.py @@ -17,7 +17,7 @@ from homeassistant.components.fan import ( SUPPORT_SET_SPEED, FanEntity, ) -from homeassistant.helpers.dispatcher import dispatcher_connect +from homeassistant.helpers.dispatcher import async_dispatcher_connect from . import DOMAIN, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, ComfoConnectBridge @@ -30,28 +30,36 @@ def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the ComfoConnect fan platform.""" ccb = hass.data[DOMAIN] - add_entities([ComfoConnectFan(hass, name=ccb.name, ccb=ccb)], True) + add_entities([ComfoConnectFan(ccb.name, ccb)], True) class ComfoConnectFan(FanEntity): """Representation of the ComfoConnect fan platform.""" - def __init__(self, hass, name, ccb: ComfoConnectBridge) -> None: + def __init__(self, name, ccb: ComfoConnectBridge) -> None: """Initialize the ComfoConnect fan.""" - self._ccb = ccb self._name = name - # Ask the bridge to keep us updated - self._ccb.comfoconnect.register_sensor(SENSOR_FAN_SPEED_MODE) + async def async_added_to_hass(self): + """Register for sensor updates.""" + await self.hass.async_add_executor_job( + self._ccb.comfoconnect.register_sensor, SENSOR_FAN_SPEED_MODE + ) + async_dispatcher_connect( + self.hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, self._handle_update + ) - def _handle_update(var): - if var == SENSOR_FAN_SPEED_MODE: - _LOGGER.debug("Dispatcher update for %s", var) - self.schedule_update_ha_state() + def _handle_update(self, var): + """Handle update callbacks.""" + if var == SENSOR_FAN_SPEED_MODE: + _LOGGER.debug("Received update for %s", var) + self.schedule_update_ha_state() - # Register for dispatcher updates - dispatcher_connect(hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, _handle_update) + @property + def should_poll(self) -> bool: + """Do not poll.""" + return False @property def name(self): @@ -71,7 +79,6 @@ class ComfoConnectFan(FanEntity): @property def speed(self): """Return the current fan mode.""" - try: speed = self._ccb.data[SENSOR_FAN_SPEED_MODE] return SPEED_MAPPING[speed] @@ -95,7 +102,7 @@ class ComfoConnectFan(FanEntity): def set_speed(self, speed: str): """Set fan speed.""" - _LOGGER.debug("Changing fan speed to %s.", speed) + _LOGGER.debug("Changing fan speed to %s", speed) if speed == SPEED_OFF: self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_AWAY) diff --git a/homeassistant/components/comfoconnect/manifest.json b/homeassistant/components/comfoconnect/manifest.json index 57daba7fdbd..091b7f7bcdd 100644 --- a/homeassistant/components/comfoconnect/manifest.json +++ b/homeassistant/components/comfoconnect/manifest.json @@ -6,5 +6,5 @@ "pycomfoconnect==0.3" ], "dependencies": [], - "codeowners": [] + "codeowners": ["@michaelarnauts"] } diff --git a/homeassistant/components/comfoconnect/sensor.py b/homeassistant/components/comfoconnect/sensor.py index 06d0506e2cf..a1f16ed9631 100644 --- a/homeassistant/components/comfoconnect/sensor.py +++ b/homeassistant/components/comfoconnect/sensor.py @@ -11,7 +11,7 @@ from pycomfoconnect import ( ) from homeassistant.const import CONF_RESOURCES, TEMP_CELSIUS -from homeassistant.helpers.dispatcher import dispatcher_connect +from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity from . import ( @@ -81,13 +81,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): sensor_type = resource.lower() if sensor_type not in SENSOR_TYPES: - _LOGGER.warning("Sensor type: %s is not a valid sensor.", sensor_type) + _LOGGER.warning("Sensor type: %s is not a valid sensor", sensor_type) continue sensors.append( ComfoConnectSensor( - hass, - name="%s %s" % (ccb.name, SENSOR_TYPES[sensor_type][0]), + name=f"{ccb.name} {SENSOR_TYPES[sensor_type][0]}", ccb=ccb, sensor_type=sensor_type, ) @@ -99,23 +98,27 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class ComfoConnectSensor(Entity): """Representation of a ComfoConnect sensor.""" - def __init__(self, hass, name, ccb: ComfoConnectBridge, sensor_type) -> None: + def __init__(self, name, ccb: ComfoConnectBridge, sensor_type) -> None: """Initialize the ComfoConnect sensor.""" self._ccb = ccb self._sensor_type = sensor_type self._sensor_id = SENSOR_TYPES[self._sensor_type][3] self._name = name - # Register the requested sensor - self._ccb.comfoconnect.register_sensor(self._sensor_id) + async def async_added_to_hass(self): + """Register for sensor updates.""" + await self.hass.async_add_executor_job( + self._ccb.comfoconnect.register_sensor, self._sensor_id + ) + async_dispatcher_connect( + self.hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, self._handle_update + ) - def _handle_update(var): - if var == self._sensor_id: - _LOGGER.debug("Dispatcher update for %s.", var) - self.schedule_update_ha_state() - - # Register for dispatcher updates - dispatcher_connect(hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, _handle_update) + def _handle_update(self, var): + """Handle update callbacks.""" + if var == self._sensor_id: + _LOGGER.debug("Received update for %s", var) + self.schedule_update_ha_state() @property def state(self): @@ -125,6 +128,11 @@ class ComfoConnectSensor(Entity): except KeyError: return None + @property + def should_poll(self) -> bool: + """Do not poll.""" + return False + @property def name(self): """Return the name of the sensor.""" From fb1fd19aae800f67c2a08a8003ce48e72554425c Mon Sep 17 00:00:00 2001 From: Jackie Yang Date: Sun, 17 Nov 2019 03:18:53 -0800 Subject: [PATCH 15/40] Fix miio air quality sensor (#28828) Fix https://github.com/home-assistant/home-assistant/issues/28827 --- homeassistant/components/xiaomi_miio/air_quality.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/xiaomi_miio/air_quality.py b/homeassistant/components/xiaomi_miio/air_quality.py index b80906aa0cb..3824c5b88cd 100644 --- a/homeassistant/components/xiaomi_miio/air_quality.py +++ b/homeassistant/components/xiaomi_miio/air_quality.py @@ -54,7 +54,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= device_info.firmware_version, device_info.hardware_version, ) - device = AirMonitorB1(name, AirQualityMonitor(host, token, model), unique_id) + device = AirMonitorB1(name, AirQualityMonitor(host, token, model=model), unique_id) async_add_entities([device], update_before_add=True) From d91eddc4f05fc4141c41de5ea0501dcb05f947d7 Mon Sep 17 00:00:00 2001 From: cgtobi Date: Mon, 18 Nov 2019 09:10:59 +0100 Subject: [PATCH 16/40] Update pyatmo to 3.0.1 (#28829) --- homeassistant/components/netatmo/manifest.json | 2 +- requirements_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/netatmo/manifest.json b/homeassistant/components/netatmo/manifest.json index f6c08faf8fa..9d1178d9d17 100644 --- a/homeassistant/components/netatmo/manifest.json +++ b/homeassistant/components/netatmo/manifest.json @@ -3,7 +3,7 @@ "name": "Netatmo", "documentation": "https://www.home-assistant.io/integrations/netatmo", "requirements": [ - "pyatmo==2.3.3" + "pyatmo==3.0.1" ], "dependencies": [ "webhook" diff --git a/requirements_all.txt b/requirements_all.txt index 6f706edc740..4ca7c2ae0f9 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1105,7 +1105,7 @@ pyalmond==0.0.2 pyarlo==0.2.3 # homeassistant.components.netatmo -pyatmo==2.3.3 +pyatmo==3.0.1 # homeassistant.components.atome pyatome==0.1.1 From bf4c81aa5e61b34011aca27d9cf9b4f212938dbe Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 18 Nov 2019 15:40:26 +0100 Subject: [PATCH 17/40] Updated frontend to 20191118.0 (#28852) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 6c59ea38fe4..51906a100cc 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191115.0" + "home-assistant-frontend==20191118.0" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 3688d6dfa38..b4ec45e9fdb 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191115.0 +home-assistant-frontend==20191118.0 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 4ca7c2ae0f9..24ab0ce339a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191115.0 +home-assistant-frontend==20191118.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c42188c920f..8c8829308cf 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191115.0 +home-assistant-frontend==20191118.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From 7966411274e1d9e7f7be3b7530fa985738f5b166 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 18 Nov 2019 15:44:17 +0100 Subject: [PATCH 18/40] Bump version --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 620af2b79db..0bc6be37dc7 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0b1" +PATCH_VERSION = "0b2" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From 89cd5d46cdb09f75bf655148e460170d09f4eddc Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 19 Nov 2019 18:33:09 +0100 Subject: [PATCH 19/40] Fix documentation URL in failed platform config check (#28814) * Fix documentation URL in failed platform config check * Replace pop from list by access using negative index * Use of split instead of rsplit --- homeassistant/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/config.py b/homeassistant/config.py index 864ced6a16a..e6be2b9c7a5 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -456,9 +456,10 @@ def _format_config_error(ex: Exception, domain: str, config: Dict) -> str: ) if domain != CONF_CORE: + integration = domain.split(".")[-1] message += ( "Please check the docs at " - "https://home-assistant.io/integrations/{}/".format(domain) + f"https://home-assistant.io/integrations/{integration}/" ) return message From 687b7fc8cbd131bde15452b2277070a514e30786 Mon Sep 17 00:00:00 2001 From: Andi Date: Mon, 18 Nov 2019 17:03:10 +0100 Subject: [PATCH 20/40] Fix Synology camera whitelist (#28822) * Fix Synology camera whitelist If whitelist config is set, not camera is added to HA at all. * Fix Synology Camera whitelist Fix typo in config key. * Update camera.py Access config dict the voluptuous way --- homeassistant/components/synology/camera.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/synology/camera.py b/homeassistant/components/synology/camera.py index 8c176f48803..91ee5a98fc3 100644 --- a/homeassistant/components/synology/camera.py +++ b/homeassistant/components/synology/camera.py @@ -62,7 +62,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= # add cameras devices = [] for camera in cameras: - if not config.get(CONF_WHITELIST): + if not config[CONF_WHITELIST] or camera.name in config[CONF_WHITELIST]: device = SynologyCamera(surveillance, camera.camera_id, verify_ssl) devices.append(device) From ab413108479fabfca76af06e1773e4a274462c83 Mon Sep 17 00:00:00 2001 From: Santobert Date: Tue, 19 Nov 2019 23:16:59 +0100 Subject: [PATCH 21/40] Fix setting colors while reproducing a lights state (#28871) * Fix setting colors while reproducing state * Reorder list --- homeassistant/components/light/reproduce_state.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/reproduce_state.py b/homeassistant/components/light/reproduce_state.py index c84b3627bed..90d14c2a19f 100644 --- a/homeassistant/components/light/reproduce_state.py +++ b/homeassistant/components/light/reproduce_state.py @@ -45,13 +45,14 @@ ATTR_GROUP = [ ] COLOR_GROUP = [ - ATTR_COLOR_NAME, - ATTR_COLOR_TEMP, ATTR_HS_COLOR, - ATTR_KELVIN, - ATTR_PROFILE, + ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_XY_COLOR, + # The following color attributes are deprecated + ATTR_PROFILE, + ATTR_COLOR_NAME, + ATTR_KELVIN, ] DEPRECATED_GROUP = [ From 69b096023a33addd5c321978ecc09a3cc28f595a Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 19 Nov 2019 14:48:51 +0100 Subject: [PATCH 22/40] Updated frontend to 20191119.0 (#28875) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 51906a100cc..d44ddb60679 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191118.0" + "home-assistant-frontend==20191119.0" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index b4ec45e9fdb..a13648d2a3b 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191118.0 +home-assistant-frontend==20191119.0 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 24ab0ce339a..13470f4b8f6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191118.0 +home-assistant-frontend==20191119.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8c8829308cf..132fddb58ba 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191118.0 +home-assistant-frontend==20191119.0 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From 9fb289ad93cb7221b24f7a6514b4e200fa805ca8 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 19 Nov 2019 23:16:43 +0100 Subject: [PATCH 23/40] Updated frontend to 20191119.1 (#28881) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index d44ddb60679..cc7722724ea 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191119.0" + "home-assistant-frontend==20191119.1" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index a13648d2a3b..f3939120124 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191119.0 +home-assistant-frontend==20191119.1 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 13470f4b8f6..9790b3c9974 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.0 +home-assistant-frontend==20191119.1 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 132fddb58ba..9f905160ebc 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.0 +home-assistant-frontend==20191119.1 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From 98c7ddc0cf66e7aebcc17b59f1adfd2035cd0cf4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 20 Nov 2019 12:30:32 +0100 Subject: [PATCH 24/40] Updated frontend to 20191119.2 (#28896) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index cc7722724ea..6e513d55742 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191119.1" + "home-assistant-frontend==20191119.2" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index f3939120124..a98bb2b46d7 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191119.1 +home-assistant-frontend==20191119.2 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 9790b3c9974..833a4d47105 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.1 +home-assistant-frontend==20191119.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 9f905160ebc..75564e13b94 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.1 +home-assistant-frontend==20191119.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From bca93ca2ec6c3adfe50b4a75a41f7173cb11a1cf Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 20 Nov 2019 12:33:39 +0100 Subject: [PATCH 25/40] Bumped version to 0.102.0b3 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 0bc6be37dc7..cb3b234595c 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0b2" +PATCH_VERSION = "0b3" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From 787aac7cf2a075996005701d177e3845c025e201 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 20 Nov 2019 22:03:01 +0100 Subject: [PATCH 26/40] Fix Almond onboarding url when using cloud (#28908) --- homeassistant/components/almond/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/homeassistant/components/almond/__init__.py b/homeassistant/components/almond/__init__.py index 6d4ab31bf17..7c1f65f3ac3 100644 --- a/homeassistant/components/almond/__init__.py +++ b/homeassistant/components/almond/__init__.py @@ -263,8 +263,6 @@ class AlmondAgent(conversation.AbstractConversationAgent): host = self.entry.data["host"] if self.entry.data.get("is_hassio"): host = "/core_almond" - elif self.entry.data["type"] != TYPE_LOCAL: - host = f"{host}/me" return { "text": "Would you like to opt-in to share your anonymized commands with Stanford to improve Almond's responses?", "url": f"{host}/conversation", From 138cee8069327b788f07c9922ffa8072b2f9db1a Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 20 Nov 2019 13:05:54 -0800 Subject: [PATCH 27/40] Version bump to 0.102.0 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index cb3b234595c..ef16de573a0 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0b3" +PATCH_VERSION = "0" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From dba87fd2e1cff8d3308ab02b470ac8cfdf09f515 Mon Sep 17 00:00:00 2001 From: cgtobi Date: Thu, 21 Nov 2019 17:35:03 +0100 Subject: [PATCH 28/40] Fix missing Netatmo sensors (#28899) * Update pyatmo to 3.0.1 * Improve sensor name * Fix missing sensors * Update pyatmo module * Update pyatmo to 3.1.0 * Update requirements * Fix method call --- homeassistant/components/netatmo/__init__.py | 2 +- .../components/netatmo/manifest.json | 4 ++-- homeassistant/components/netatmo/sensor.py | 24 ++++++++++++------- requirements_all.txt | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/netatmo/__init__.py b/homeassistant/components/netatmo/__init__.py index 4b9f0690ac5..de371f97e28 100644 --- a/homeassistant/components/netatmo/__init__.py +++ b/homeassistant/components/netatmo/__init__.py @@ -259,4 +259,4 @@ class CameraData: @Throttle(MIN_TIME_BETWEEN_EVENT_UPDATES) def update_event(self): """Call the Netatmo API to update the events.""" - self.camera_data.updateEvent(home=self.home, cameratype=self.camera_type) + self.camera_data.updateEvent(home=self.home, devicetype=self.camera_type) diff --git a/homeassistant/components/netatmo/manifest.json b/homeassistant/components/netatmo/manifest.json index 9d1178d9d17..232e99eeae8 100644 --- a/homeassistant/components/netatmo/manifest.json +++ b/homeassistant/components/netatmo/manifest.json @@ -3,10 +3,10 @@ "name": "Netatmo", "documentation": "https://www.home-assistant.io/integrations/netatmo", "requirements": [ - "pyatmo==3.0.1" + "pyatmo==3.1.0" ], "dependencies": [ "webhook" ], "codeowners": [] -} +} \ No newline at end of file diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index f76062035d2..fa7aedae739 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -155,14 +155,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): for module in all_module_infos.values(): if module["module_name"] not in module_names: continue + _LOGGER.debug( + "Adding module %s %s", module["module_name"], module["id"] + ) for condition in data.station_data.monitoredConditions( moduleId=module["id"] ): - _LOGGER.debug( - "Adding %s %s", - module["module_name"], - data.station_data.moduleById(mid=module["id"]), - ) entities.append(NetatmoSensor(data, module, condition.lower())) return entities @@ -200,18 +198,26 @@ class NetatmoSensor(Entity): def __init__(self, netatmo_data, module_info, sensor_type): """Initialize the sensor.""" self.netatmo_data = netatmo_data - module = self.netatmo_data.station_data.moduleById(mid=module_info["id"]) - if module["type"] == "NHC": + + device = self.netatmo_data.station_data.moduleById(mid=module_info["id"]) + if not device: + # Assume it's a station if module can't be found + device = self.netatmo_data.station_data.stationById(sid=module_info["id"]) + + if device["type"] == "NHC": self.module_name = module_info["station_name"] else: - self.module_name = module_info["module_name"] + self.module_name = ( + f"{module_info['station_name']} {module_info['module_name']}" + ) + self._name = f"{DOMAIN} {self.module_name} {SENSOR_TYPES[sensor_type][0]}" self.type = sensor_type self._state = None self._device_class = SENSOR_TYPES[self.type][3] self._icon = SENSOR_TYPES[self.type][2] self._unit_of_measurement = SENSOR_TYPES[self.type][1] - self._module_type = module["type"] + self._module_type = device["type"] self._module_id = module_info["id"] self._unique_id = f"{self._module_id}-{self.type}" diff --git a/requirements_all.txt b/requirements_all.txt index 833a4d47105..2b7255b09fa 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1105,7 +1105,7 @@ pyalmond==0.0.2 pyarlo==0.2.3 # homeassistant.components.netatmo -pyatmo==3.0.1 +pyatmo==3.1.0 # homeassistant.components.atome pyatome==0.1.1 From 42809ad6a99c2a2e923f0423db1750b763b9106a Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 21 Nov 2019 19:05:26 +0100 Subject: [PATCH 29/40] Updated frontend to 20191119.5 (#28925) * Updated frontend to 20191119.4 * Updated frontend to 20191119.5 --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 6e513d55742..41728bc1664 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191119.2" + "home-assistant-frontend==20191119.5" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index a98bb2b46d7..1c4aaa1191f 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191119.2 +home-assistant-frontend==20191119.5 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 2b7255b09fa..651c089a4fd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.2 +home-assistant-frontend==20191119.5 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 75564e13b94..8fc004f3363 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.2 +home-assistant-frontend==20191119.5 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From 3391fc660aabcd5c79761626f1d20d64cfb89916 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 21 Nov 2019 12:25:12 -0800 Subject: [PATCH 30/40] Bumped version to 0.102.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index ef16de573a0..3520260481b 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "0" +PATCH_VERSION = "1" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From ab9a60f83f20bfe63655a675fe4a691e74c7baf1 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Thu, 21 Nov 2019 14:39:24 -0600 Subject: [PATCH 31/40] Delay Plex websocket connection to avoid race (#28934) --- homeassistant/components/plex/__init__.py | 7 ++++++- homeassistant/components/plex/media_player.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/plex/__init__.py b/homeassistant/components/plex/__init__.py index 4a575722826..386be56340a 100644 --- a/homeassistant/components/plex/__init__.py +++ b/homeassistant/components/plex/__init__.py @@ -16,6 +16,7 @@ from homeassistant.const import ( CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL, + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, ) from homeassistant.helpers import config_validation as cv @@ -164,12 +165,16 @@ async def async_setup_entry(hass, entry): websocket = PlexWebsocket( plex_server.plex_server, update_plex, session=session, verify_ssl=verify_ssl ) - hass.loop.create_task(websocket.listen()) hass.data[PLEX_DOMAIN][WEBSOCKETS][server_id] = websocket + async def async_start_websocket_session(_): + await websocket.listen() + def close_websocket_session(_): websocket.close() + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, async_start_websocket_session) + unsub = hass.bus.async_listen_once( EVENT_HOMEASSISTANT_STOP, close_websocket_session ) diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index d6720fd9e95..ad5fb2f73f1 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -68,6 +68,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): hass, PLEX_NEW_MP_SIGNAL.format(server_id), async_new_media_players ) hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub) + _LOGGER.debug("New entity listener created") @callback From c38240673535ba03fec4f404926015a074c689e5 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Sat, 23 Nov 2019 09:16:21 -0600 Subject: [PATCH 32/40] Fix Plex setup race condition v2 (#28943) * Connect websocket when platforms ready, not when HA is ready * Use callbacks from platform setup tasks instead * Convert setup to async * Apply suggestions from code review Co-Authored-By: Martin Hjelmare --- homeassistant/components/plex/__init__.py | 34 +++++++++++++---------- homeassistant/components/plex/const.py | 3 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/plex/__init__.py b/homeassistant/components/plex/__init__.py index 386be56340a..97103230288 100644 --- a/homeassistant/components/plex/__init__.py +++ b/homeassistant/components/plex/__init__.py @@ -1,5 +1,6 @@ """Support to embed Plex.""" import asyncio +import functools import logging import plexapi.exceptions @@ -16,7 +17,6 @@ from homeassistant.const import ( CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL, - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, ) from homeassistant.helpers import config_validation as cv @@ -37,6 +37,7 @@ from .const import ( DISPATCHERS, DOMAIN as PLEX_DOMAIN, PLATFORMS, + PLATFORMS_COMPLETED, PLEX_MEDIA_PLAYER_OPTIONS, PLEX_SERVER_CONFIG, PLEX_UPDATE_PLATFORMS_SIGNAL, @@ -72,18 +73,21 @@ CONFIG_SCHEMA = vol.Schema({PLEX_DOMAIN: SERVER_CONFIG_SCHEMA}, extra=vol.ALLOW_ _LOGGER = logging.getLogger(__package__) -def setup(hass, config): +async def async_setup(hass, config): """Set up the Plex component.""" - hass.data.setdefault(PLEX_DOMAIN, {SERVERS: {}, DISPATCHERS: {}, WEBSOCKETS: {}}) + hass.data.setdefault( + PLEX_DOMAIN, + {SERVERS: {}, DISPATCHERS: {}, WEBSOCKETS: {}, PLATFORMS_COMPLETED: {}}, + ) plex_config = config.get(PLEX_DOMAIN, {}) if plex_config: - _setup_plex(hass, plex_config) + _async_setup_plex(hass, plex_config) return True -def _setup_plex(hass, config): +def _async_setup_plex(hass, config): """Pass configuration to a config flow.""" server_config = dict(config) if MP_DOMAIN in server_config: @@ -141,11 +145,7 @@ async def async_setup_entry(hass, entry): ) server_id = plex_server.machine_identifier hass.data[PLEX_DOMAIN][SERVERS][server_id] = plex_server - - for platform in PLATFORMS: - hass.async_create_task( - hass.config_entries.async_forward_entry_setup(entry, platform) - ) + hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id] = set() entry.add_update_listener(async_options_updated) @@ -167,19 +167,25 @@ async def async_setup_entry(hass, entry): ) hass.data[PLEX_DOMAIN][WEBSOCKETS][server_id] = websocket - async def async_start_websocket_session(_): - await websocket.listen() + def start_websocket_session(platform, _): + hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id].add(platform) + if hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id] == PLATFORMS: + hass.loop.create_task(websocket.listen()) def close_websocket_session(_): websocket.close() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, async_start_websocket_session) - unsub = hass.bus.async_listen_once( EVENT_HOMEASSISTANT_STOP, close_websocket_session ) hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub) + for platform in PLATFORMS: + task = hass.async_create_task( + hass.config_entries.async_forward_entry_setup(entry, platform) + ) + task.add_done_callback(functools.partial(start_websocket_session, platform)) + return True diff --git a/homeassistant/components/plex/const.py b/homeassistant/components/plex/const.py index d3c79e60bc4..ad62bade1fd 100644 --- a/homeassistant/components/plex/const.py +++ b/homeassistant/components/plex/const.py @@ -9,7 +9,8 @@ DEFAULT_SSL = False DEFAULT_VERIFY_SSL = True DISPATCHERS = "dispatchers" -PLATFORMS = ["media_player", "sensor"] +PLATFORMS = frozenset(["media_player", "sensor"]) +PLATFORMS_COMPLETED = "platforms_completed" SERVERS = "servers" WEBSOCKETS = "websockets" From 2e85e3662f06c22324bc28d35bae9b2f25a751ef Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 22 Nov 2019 15:32:05 +0100 Subject: [PATCH 33/40] Fix ikea lights on deconz (#28949) * Fix ikea lights on deconz * check for None * Use cleaner code style --- homeassistant/components/deconz/light.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index bf4b05089a8..eda2041b923 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -152,6 +152,8 @@ class DeconzLight(DeconzDevice, Light): if ATTR_TRANSITION in kwargs: data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10) + elif "IKEA" in (self._device.manufacturer or ""): + data["transitiontime"] = 0 if ATTR_FLASH in kwargs: if kwargs[ATTR_FLASH] == FLASH_SHORT: From 481f71107bff1dd94897f34e41a34c8e9f73691a Mon Sep 17 00:00:00 2001 From: cgtobi Date: Sat, 23 Nov 2019 11:00:26 +0100 Subject: [PATCH 34/40] Fix manual config (#28956) --- homeassistant/components/netatmo/sensor.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index fa7aedae739..1ae076c6560 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -547,13 +547,18 @@ class NetatmoData: self.data = {} self.station_data = self.data_class(self.auth) self.station = station + self.station_id = None + if station: + station_data = self.station_data.stationByName(self.station) + if station_data: + self.station_id = station_data.get("_id") self._next_update = time() self._update_in_progress = threading.Lock() def get_module_infos(self): """Return all modules available on the API as a dict.""" - if self.station is not None: - return self.station_data.getModules(station=self.station) + if self.station_id is not None: + return self.station_data.getModules(station_id=self.station_id) return self.station_data.getModules() def update(self): @@ -579,7 +584,7 @@ class NetatmoData: return data = self.station_data.lastData( - station=self.station, exclude=3600, byId=True + station=self.station_id, exclude=3600, byId=True ) if not data: self._next_update = time() + NETATMO_UPDATE_INTERVAL From a56f7f5d7556cfb16d9c6b4f83ccd7717244785e Mon Sep 17 00:00:00 2001 From: shred86 <32663154+shred86@users.noreply.github.com> Date: Sat, 23 Nov 2019 03:29:54 -0800 Subject: [PATCH 35/40] Fix temp not being reported properly (#28973) --- homeassistant/components/abode/sensor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/abode/sensor.py b/homeassistant/components/abode/sensor.py index d84bfe52441..573df6d49b4 100644 --- a/homeassistant/components/abode/sensor.py +++ b/homeassistant/components/abode/sensor.py @@ -72,19 +72,19 @@ class AbodeSensor(AbodeDevice): @property def state(self): """Return the state of the sensor.""" - if self._sensor_type == "temp": + if self._sensor_type == CONST.TEMP_STATUS_KEY: return self._device.temp - if self._sensor_type == "humidity": + if self._sensor_type == CONST.HUMI_STATUS_KEY: return self._device.humidity - if self._sensor_type == "lux": + if self._sensor_type == CONST.LUX_STATUS_KEY: return self._device.lux @property def unit_of_measurement(self): """Return the units of measurement.""" - if self._sensor_type == "temp": + if self._sensor_type == CONST.TEMP_STATUS_KEY: return self._device.temp_unit - if self._sensor_type == "humidity": + if self._sensor_type == CONST.HUMI_STATUS_KEY: return self._device.humidity_unit - if self._sensor_type == "lux": + if self._sensor_type == CONST.LUX_STATUS_KEY: return self._device.lux_unit From 2af1ba749260d96fec50e9e1e7c6f290bae0c81c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sat, 23 Nov 2019 22:12:56 +0100 Subject: [PATCH 36/40] Updated frontend to 20191119.6 (#28996) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 41728bc1664..b196239dfb1 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20191119.5" + "home-assistant-frontend==20191119.6" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 1c4aaa1191f..07ebfdec4f9 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7" cryptography==2.8 distro==1.4.0 hass-nabucasa==0.29 -home-assistant-frontend==20191119.5 +home-assistant-frontend==20191119.6 importlib-metadata==0.23 jinja2>=2.10.3 netdisco==2.6.0 diff --git a/requirements_all.txt b/requirements_all.txt index 651c089a4fd..e8307161c09 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -655,7 +655,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.5 +home-assistant-frontend==20191119.6 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8fc004f3363..2aa46e28f7a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -222,7 +222,7 @@ hole==0.5.0 holidays==0.9.11 # homeassistant.components.frontend -home-assistant-frontend==20191119.5 +home-assistant-frontend==20191119.6 # homeassistant.components.zwave homeassistant-pyozw==0.1.4 From b10d42e33023a24dc51e4b610f5f4f55b1cacdd7 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 25 Nov 2019 04:57:18 +0100 Subject: [PATCH 37/40] Alexa gracefully handle climate devices without presets (#29010) --- homeassistant/components/alexa/capabilities.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/alexa/capabilities.py b/homeassistant/components/alexa/capabilities.py index 7d74bb3f8cd..49b5c5141b6 100644 --- a/homeassistant/components/alexa/capabilities.py +++ b/homeassistant/components/alexa/capabilities.py @@ -752,10 +752,11 @@ class AlexaThermostatController(AlexaCapability): supported_modes.append(thermostat_mode) preset_modes = self.entity.attributes.get(climate.ATTR_PRESET_MODES) - for mode in preset_modes: - thermostat_mode = API_THERMOSTAT_PRESETS.get(mode) - if thermostat_mode: - supported_modes.append(thermostat_mode) + if preset_modes: + for mode in preset_modes: + thermostat_mode = API_THERMOSTAT_PRESETS.get(mode) + if thermostat_mode: + supported_modes.append(thermostat_mode) # Return False for supportsScheduling until supported with event listener in handler. configuration = {"supportsScheduling": False} From 8a467bbf5c4bee5938b2b2a6b4a2c135440aafd2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 24 Nov 2019 19:57:50 -0800 Subject: [PATCH 38/40] Bumped version to 0.102.2 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 3520260481b..8b62d011fda 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "1" +PATCH_VERSION = "2" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1) From 2d5d40ce0ea34312717b066bd179b8b75fffa66c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 29 Nov 2019 18:29:45 +0100 Subject: [PATCH 39/40] Fix smartthings cloud webhook (#29219) * Fix smartthings cloud webhook * Update smartapp.py --- homeassistant/components/smartthings/smartapp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/smartthings/smartapp.py b/homeassistant/components/smartthings/smartapp.py index ecd4da5dcab..6acd29397ae 100644 --- a/homeassistant/components/smartthings/smartapp.py +++ b/homeassistant/components/smartthings/smartapp.py @@ -234,7 +234,7 @@ async def setup_smartapp_endpoint(hass: HomeAssistantType): and not hass.config_entries.async_entries(DOMAIN) ): cloudhook_url = await hass.components.cloud.async_create_cloudhook( - hass, config[CONF_WEBHOOK_ID] + config[CONF_WEBHOOK_ID] ) config[CONF_CLOUDHOOK_URL] = cloudhook_url await store.async_save(config) @@ -287,7 +287,7 @@ async def unload_smartapp_endpoint(hass: HomeAssistantType): and hass.components.cloud.async_is_logged_in() ): await hass.components.cloud.async_delete_cloudhook( - hass, hass.data[DOMAIN][CONF_WEBHOOK_ID] + hass.data[DOMAIN][CONF_WEBHOOK_ID] ) # Remove cloudhook from storage store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY) From ec008ddbe441e800f3170e605cd4e85c82b7bfe8 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 29 Nov 2019 17:48:08 +0000 Subject: [PATCH 40/40] Bump version 0.102.3 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 8b62d011fda..927739486d6 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 102 -PATCH_VERSION = "2" +PATCH_VERSION = "3" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 1)