From a5f00d1db26db6a9ac0f06950dfce78ea9d99cc5 Mon Sep 17 00:00:00 2001 From: Harrison Pace Date: Tue, 22 Sep 2020 17:01:58 +1000 Subject: [PATCH 01/25] Use Cloud State as alternative state if condition unknown (#37121) --- homeassistant/components/bom/weather.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/bom/weather.py b/homeassistant/components/bom/weather.py index 94b9960c851..9229d0c11d4 100644 --- a/homeassistant/components/bom/weather.py +++ b/homeassistant/components/bom/weather.py @@ -54,7 +54,9 @@ class BOMWeather(WeatherEntity): @property def condition(self): """Return the current condition.""" - return self.bom_data.get_reading("weather") + return self.bom_data.get_reading("weather") or self.bom_data.get_reading( + "cloud" + ) # Now implement the WeatherEntity interface From 3efda8d1d2fdeb6e6b9895846951e030a2aacc2e Mon Sep 17 00:00:00 2001 From: Markus Haack Date: Wed, 23 Sep 2020 04:04:01 +0200 Subject: [PATCH 02/25] Guard SolarEdge for inverters without batteries (#40295) --- homeassistant/components/solaredge/sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/solaredge/sensor.py b/homeassistant/components/solaredge/sensor.py index 3888b8bf536..2b085d1ba40 100644 --- a/homeassistant/components/solaredge/sensor.py +++ b/homeassistant/components/solaredge/sensor.py @@ -267,7 +267,8 @@ class SolarEdgeStorageLevelSensor(SolarEdgeSensor): """Get the latest inventory data and update state and attributes.""" self.data_service.update() attr = self.data_service.attributes.get(self._json_key) - self._state = attr["soc"] + if attr and "soc" in attr: + self._state = attr["soc"] class SolarEdgeDataService: From f1ee7fed4c5bcc75b02d818a529526e29ee40897 Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Mon, 21 Sep 2020 09:26:24 +0800 Subject: [PATCH 03/25] Ignore packets with missing dts in peek_first_pts (#40299) --- homeassistant/components/stream/worker.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/stream/worker.py b/homeassistant/components/stream/worker.py index b76896b815a..40231d87a53 100644 --- a/homeassistant/components/stream/worker.py +++ b/homeassistant/components/stream/worker.py @@ -113,7 +113,11 @@ def _stream_worker_internal(hass, stream, quit_event): # Get to first video keyframe while first_packet[video_stream] is None: packet = next(container.demux()) - if packet.stream == video_stream and packet.is_keyframe: + if ( + packet.stream == video_stream + and packet.is_keyframe + and packet.dts is not None + ): first_packet[video_stream] = packet initial_packets.append(packet) # Get first_pts from subsequent frame to first keyframe @@ -121,6 +125,8 @@ def _stream_worker_internal(hass, stream, quit_event): [pts is None for pts in {**first_packet, **first_pts}.values()] ) and (len(initial_packets) < PACKETS_TO_WAIT_FOR_AUDIO): packet = next(container.demux((video_stream, audio_stream))) + if packet.dts is None: + continue # Discard packets with no dts if ( first_packet[packet.stream] is None ): # actually video already found above so only for audio From b3e2426967a96bb194dfcbd514590c0d05b63927 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Tue, 22 Sep 2020 10:57:26 +0200 Subject: [PATCH 04/25] Axis - Fix list applications breaks if empty response (#40360) --- homeassistant/components/axis/manifest.json | 8 ++++---- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/axis/manifest.json b/homeassistant/components/axis/manifest.json index ceb926f326e..959d53a01ae 100644 --- a/homeassistant/components/axis/manifest.json +++ b/homeassistant/components/axis/manifest.json @@ -3,11 +3,11 @@ "name": "Axis", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/axis", - "requirements": ["axis==35"], + "requirements": ["axis==37"], "zeroconf": [ - {"type":"_axis-video._tcp.local.","macaddress":"00408C*"}, - {"type":"_axis-video._tcp.local.","macaddress":"ACCC8E*"}, - {"type":"_axis-video._tcp.local.","macaddress":"B8A44F*"} + { "type": "_axis-video._tcp.local.", "macaddress": "00408C*" }, + { "type": "_axis-video._tcp.local.", "macaddress": "ACCC8E*" }, + { "type": "_axis-video._tcp.local.", "macaddress": "B8A44F*" } ], "after_dependencies": ["mqtt"], "codeowners": ["@Kane610"] diff --git a/requirements_all.txt b/requirements_all.txt index 6aea10a43cf..84a213a71c3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -309,7 +309,7 @@ av==8.0.2 avri-api==0.1.7 # homeassistant.components.axis -axis==35 +axis==37 # homeassistant.components.azure_event_hub azure-eventhub==5.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d5bd1f036b2..381a9e71817 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -174,7 +174,7 @@ av==8.0.2 avri-api==0.1.7 # homeassistant.components.axis -axis==35 +axis==37 # homeassistant.components.azure_event_hub azure-eventhub==5.1.0 From babaf48867b529ded74a64a0725720acb6f69d86 Mon Sep 17 00:00:00 2001 From: Michael Thingnes Date: Mon, 21 Sep 2020 09:56:04 +1200 Subject: [PATCH 05/25] Fix Met.no missing conditions in API forecasts (#40373) --- homeassistant/components/met/weather.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/met/weather.py b/homeassistant/components/met/weather.py index 3355c497aab..3abd7638516 100644 --- a/homeassistant/components/met/weather.py +++ b/homeassistant/components/met/weather.py @@ -214,8 +214,9 @@ class MetWeather(CoordinatorEntity, WeatherEntity): ha_item = { k: met_item[v] for k, v in FORECAST_MAP.items() if met_item.get(v) } - ha_item[ATTR_FORECAST_CONDITION] = format_condition( - ha_item[ATTR_FORECAST_CONDITION] - ) + if ha_item.get(ATTR_FORECAST_CONDITION): + ha_item[ATTR_FORECAST_CONDITION] = format_condition( + ha_item[ATTR_FORECAST_CONDITION] + ) ha_forecast.append(ha_item) return ha_forecast From 1901cc962e6b151312482d9ff6fa30a27709308f Mon Sep 17 00:00:00 2001 From: Tom Harris Date: Mon, 21 Sep 2020 16:40:29 -0400 Subject: [PATCH 06/25] Bump pyinsteon to 1.0.8 (#40383) --- homeassistant/components/insteon/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/insteon/manifest.json b/homeassistant/components/insteon/manifest.json index 871629b6877..d20f56054b3 100644 --- a/homeassistant/components/insteon/manifest.json +++ b/homeassistant/components/insteon/manifest.json @@ -2,7 +2,7 @@ "domain": "insteon", "name": "Insteon", "documentation": "https://www.home-assistant.io/integrations/insteon", - "requirements": ["pyinsteon==1.0.7"], + "requirements": ["pyinsteon==1.0.8"], "codeowners": ["@teharris1"], "config_flow": true } \ No newline at end of file diff --git a/requirements_all.txt b/requirements_all.txt index 84a213a71c3..61129b6e4a5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1401,7 +1401,7 @@ pyialarm==0.3 pyicloud==0.9.7 # homeassistant.components.insteon -pyinsteon==1.0.7 +pyinsteon==1.0.8 # homeassistant.components.intesishome pyintesishome==1.7.5 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 381a9e71817..2cd39e7d9c5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -674,7 +674,7 @@ pyhomematic==0.1.68 pyicloud==0.9.7 # homeassistant.components.insteon -pyinsteon==1.0.7 +pyinsteon==1.0.8 # homeassistant.components.ipma pyipma==2.0.5 From b1ac9205057170882460e2da46f954af5b0106b2 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Mon, 21 Sep 2020 21:10:02 +0200 Subject: [PATCH 07/25] Fix OSError (#40393) --- homeassistant/components/shelly/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/__init__.py b/homeassistant/components/shelly/__init__.py index 83d5d7b9f3a..c3b701449c2 100644 --- a/homeassistant/components/shelly/__init__.py +++ b/homeassistant/components/shelly/__init__.py @@ -86,7 +86,7 @@ class ShellyDeviceWrapper(update_coordinator.DataUpdateCoordinator): try: async with async_timeout.timeout(5): return await self.device.update() - except aiocoap_error.Error as err: + except (aiocoap_error.Error, OSError) as err: raise update_coordinator.UpdateFailed("Error fetching data") from err @property From 44be19037875fe1573272f1667aa0cb021d388b6 Mon Sep 17 00:00:00 2001 From: On Freund Date: Mon, 21 Sep 2020 21:27:00 +0300 Subject: [PATCH 08/25] Fix handling of empty ws port (#40399) --- homeassistant/components/kodi/config_flow.py | 4 ++ tests/components/kodi/test_config_flow.py | 45 ++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/homeassistant/components/kodi/config_flow.py b/homeassistant/components/kodi/config_flow.py index 067ee8be476..c11255aba87 100644 --- a/homeassistant/components/kodi/config_flow.py +++ b/homeassistant/components/kodi/config_flow.py @@ -202,6 +202,10 @@ class KodiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): if user_input is not None: self._ws_port = user_input.get(CONF_WS_PORT) + # optional ints return 0 rather than None when empty + if self._ws_port == 0: + self._ws_port = None + try: await validate_ws(self.hass, self._get_data()) except WSCannotConnect: diff --git a/tests/components/kodi/test_config_flow.py b/tests/components/kodi/test_config_flow.py index 4fd61ede8ba..71c2bce1307 100644 --- a/tests/components/kodi/test_config_flow.py +++ b/tests/components/kodi/test_config_flow.py @@ -165,6 +165,51 @@ async def test_form_valid_ws_port(hass, user_flow): assert len(mock_setup_entry.mock_calls) == 1 +async def test_form_empty_ws_port(hass, user_flow): + """Test we handle an empty websocket port input.""" + with patch( + "homeassistant.components.kodi.config_flow.Kodi.ping", + return_value=True, + ), patch.object( + MockWSConnection, + "connect", + AsyncMock(side_effect=CannotConnectError), + ), patch( + "homeassistant.components.kodi.config_flow.get_kodi_connection", + new=get_kodi_connection, + ): + result = await hass.config_entries.flow.async_configure(user_flow, TEST_HOST) + + assert result["type"] == "form" + assert result["step_id"] == "ws_port" + assert result["errors"] == {} + + with patch( + "homeassistant.components.kodi.async_setup", return_value=True + ) as mock_setup, patch( + "homeassistant.components.kodi.async_setup_entry", + return_value=True, + ) as mock_setup_entry: + result = await hass.config_entries.flow.async_configure( + result["flow_id"], {"ws_port": 0} + ) + + assert result["type"] == "create_entry" + assert result["title"] == TEST_HOST["host"] + assert result["data"] == { + **TEST_HOST, + "ws_port": None, + "password": None, + "username": None, + "name": None, + "timeout": DEFAULT_TIMEOUT, + } + + await hass.async_block_till_done() + assert len(mock_setup.mock_calls) == 1 + assert len(mock_setup_entry.mock_calls) == 1 + + async def test_form_invalid_auth(hass, user_flow): """Test we handle invalid auth.""" with patch( From ed17a81f501136a4b033d8ecc86fdfbcc45be94c Mon Sep 17 00:00:00 2001 From: Michael Thingnes Date: Tue, 22 Sep 2020 07:56:08 +1200 Subject: [PATCH 09/25] Validate Met.no forecast entries before passing them on to HA (#40400) --- homeassistant/components/met/weather.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/met/weather.py b/homeassistant/components/met/weather.py index 3abd7638516..e4c64f9aeda 100644 --- a/homeassistant/components/met/weather.py +++ b/homeassistant/components/met/weather.py @@ -5,6 +5,8 @@ import voluptuous as vol from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, + ATTR_FORECAST_TEMP, + ATTR_FORECAST_TIME, ATTR_WEATHER_HUMIDITY, ATTR_WEATHER_PRESSURE, ATTR_WEATHER_TEMPERATURE, @@ -209,8 +211,11 @@ class MetWeather(CoordinatorEntity, WeatherEntity): met_forecast = self.coordinator.data.hourly_forecast else: met_forecast = self.coordinator.data.daily_forecast + required_keys = {ATTR_FORECAST_TEMP, ATTR_FORECAST_TIME} ha_forecast = [] for met_item in met_forecast: + if not set(met_item).issuperset(required_keys): + continue ha_item = { k: met_item[v] for k, v in FORECAST_MAP.items() if met_item.get(v) } From 532c624d0169c263dd20bd46d4c99fba0467b241 Mon Sep 17 00:00:00 2001 From: cagnulein Date: Tue, 22 Sep 2020 10:53:46 +0200 Subject: [PATCH 10/25] Fix luci device_tracker incorrectly reporting devices status (#40409) --- homeassistant/components/luci/device_tracker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/luci/device_tracker.py b/homeassistant/components/luci/device_tracker.py index fe64c90bf4c..40b111d0d83 100644 --- a/homeassistant/components/luci/device_tracker.py +++ b/homeassistant/components/luci/device_tracker.py @@ -94,7 +94,11 @@ class LuciDeviceScanner(DeviceScanner): last_results = [] for device in result: - if device.reachable: + if ( + not hasattr(self.router.router.owrt_version, "release") + or self.router.router.owrt_version.release[0] < 19 + or device.reachable + ): last_results.append(device) self.last_results = last_results From 6cccd87318c2eee0c10ce01c1d87ce2131ad9eec Mon Sep 17 00:00:00 2001 From: jan iversen Date: Wed, 23 Sep 2020 15:50:01 +0200 Subject: [PATCH 11/25] Make modbus switch read_coil failure resistent (#40417) * Make modbus switch read_coil failure resistent. Make sure all return paths return true/false. * Add comment how binary_sensor get its value (is_on). --- homeassistant/components/modbus/switch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/modbus/switch.py b/homeassistant/components/modbus/switch.py index c238e105659..fa5b42807b0 100644 --- a/homeassistant/components/modbus/switch.py +++ b/homeassistant/components/modbus/switch.py @@ -158,20 +158,23 @@ class ModbusCoilSwitch(ToggleEntity, RestoreEntity): """Update the state of the switch.""" self._is_on = self._read_coil(self._coil) - def _read_coil(self, coil) -> Optional[bool]: + def _read_coil(self, coil) -> bool: """Read coil using the Modbus hub slave.""" try: result = self._hub.read_coils(self._slave, coil, 1) except ConnectionException: self._available = False - return + return False if isinstance(result, (ModbusException, ExceptionResponse)): self._available = False - return + return False self._available = True - return bool(result.bits[coil]) + # bits[0] select the lowest bit in result, + # is_on for a binary_sensor is true if the bit are 1 + # The other bits are not considered. + return bool(result.bits[0]) def _write_coil(self, coil, value): """Write coil using the Modbus hub slave.""" From 297e5300b4122083c45e668587db2b55b5dc63bb Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Tue, 22 Sep 2020 09:49:44 +0100 Subject: [PATCH 12/25] Fix webostv supported features for "external_speaker" sound output (#40435) --- homeassistant/components/webostv/media_player.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py index e53e3185651..66645ee1fb9 100644 --- a/homeassistant/components/webostv/media_player.py +++ b/homeassistant/components/webostv/media_player.py @@ -305,7 +305,9 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity): """Flag media player features that are supported.""" supported = SUPPORT_WEBOSTV - if self._client.sound_output == "external_arc": + if (self._client.sound_output == "external_arc") or ( + self._client.sound_output == "external_speaker" + ): supported = supported | SUPPORT_WEBOSTV_VOLUME elif self._client.sound_output != "lineout": supported = supported | SUPPORT_WEBOSTV_VOLUME | SUPPORT_VOLUME_SET From 95e6969912b24417df2d80344323a17a07f1941b Mon Sep 17 00:00:00 2001 From: MeIchthys <10717998+meichthys@users.noreply.github.com> Date: Tue, 22 Sep 2020 04:58:51 -0400 Subject: [PATCH 13/25] Fix regression in Nextcloud component (#40438) --- homeassistant/components/nextcloud/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/nextcloud/__init__.py b/homeassistant/components/nextcloud/__init__.py index ff94fd708db..1a773040980 100644 --- a/homeassistant/components/nextcloud/__init__.py +++ b/homeassistant/components/nextcloud/__init__.py @@ -100,6 +100,7 @@ def setup(hass, config): _LOGGER.error("Nextcloud setup failed - Check configuration") hass.data[DOMAIN] = get_data_points(ncm.data) + hass.data[DOMAIN]["instance"] = conf[CONF_URL] def nextcloud_update(event_time): """Update data from nextcloud api.""" From 34c0e0f58dacb6317c1ef435cdeb84328f98ab38 Mon Sep 17 00:00:00 2001 From: square99 Date: Wed, 23 Sep 2020 00:34:23 +0900 Subject: [PATCH 14/25] Fix proxy camera conversion with PNG Alpha(RGBA) (#40446) --- homeassistant/components/proxy/camera.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/proxy/camera.py b/homeassistant/components/proxy/camera.py index 754f09fa199..c3f7151431a 100644 --- a/homeassistant/components/proxy/camera.py +++ b/homeassistant/components/proxy/camera.py @@ -77,6 +77,8 @@ def _precheck_image(image, opts): if imgfmt not in ("PNG", "JPEG"): _LOGGER.warning("Image is of unsupported type: %s", imgfmt) raise ValueError() + if not img.mode == "RGB": + img = img.convert("RGB") return img From 016834185ac0385efa46b8a6e4467cecfb44fa83 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Tue, 22 Sep 2020 17:36:44 +0200 Subject: [PATCH 15/25] Bump accuweather library to version 0.0.11 (#40458) --- homeassistant/components/accuweather/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/accuweather/manifest.json b/homeassistant/components/accuweather/manifest.json index a383c49f348..6ccd6a4f10b 100644 --- a/homeassistant/components/accuweather/manifest.json +++ b/homeassistant/components/accuweather/manifest.json @@ -2,7 +2,7 @@ "domain": "accuweather", "name": "AccuWeather", "documentation": "https://www.home-assistant.io/integrations/accuweather/", - "requirements": ["accuweather==0.0.10"], + "requirements": ["accuweather==0.0.11"], "codeowners": ["@bieniu"], "config_flow": true, "quality_scale": "platinum" diff --git a/requirements_all.txt b/requirements_all.txt index 61129b6e4a5..c6dfacff9c9 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -102,7 +102,7 @@ YesssSMS==0.4.1 abodepy==1.1.0 # homeassistant.components.accuweather -accuweather==0.0.10 +accuweather==0.0.11 # homeassistant.components.mcp23017 adafruit-blinka==3.9.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 2cd39e7d9c5..15aa3affb8c 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -45,7 +45,7 @@ YesssSMS==0.4.1 abodepy==1.1.0 # homeassistant.components.accuweather -accuweather==0.0.10 +accuweather==0.0.11 # homeassistant.components.androidtv adb-shell[async]==0.2.1 From f953454374fb3d30f972096cecc3a11e414f9415 Mon Sep 17 00:00:00 2001 From: Robert Van Gorkom Date: Tue, 22 Sep 2020 16:00:27 -0700 Subject: [PATCH 16/25] Increase gogogate2 request timeout (#40461) --- homeassistant/components/gogogate2/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/gogogate2/manifest.json b/homeassistant/components/gogogate2/manifest.json index a12058d38d0..893294da25e 100644 --- a/homeassistant/components/gogogate2/manifest.json +++ b/homeassistant/components/gogogate2/manifest.json @@ -3,7 +3,7 @@ "name": "Gogogate2 and iSmartGate", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/gogogate2", - "requirements": ["gogogate2-api==2.0.2"], + "requirements": ["gogogate2-api==2.0.3"], "codeowners": ["@vangorra"], "homekit": { "models": [ diff --git a/requirements_all.txt b/requirements_all.txt index c6dfacff9c9..3d3bd4ace9e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -669,7 +669,7 @@ glances_api==0.2.0 gntp==1.0.3 # homeassistant.components.gogogate2 -gogogate2-api==2.0.2 +gogogate2-api==2.0.3 # homeassistant.components.google google-api-python-client==1.6.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 15aa3affb8c..911da004e3c 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -334,7 +334,7 @@ gios==0.1.4 glances_api==0.2.0 # homeassistant.components.gogogate2 -gogogate2-api==2.0.2 +gogogate2-api==2.0.3 # homeassistant.components.google google-api-python-client==1.6.4 From 0ebeb161e1df3cc6d751950b384be0f3c1cc8b55 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Wed, 23 Sep 2020 09:21:57 +0200 Subject: [PATCH 17/25] Fix handling of quoted time_pattern values (#40470) Co-authored-by: J. Nick Koston Co-authored-by: Franck Nijhof --- .../homeassistant/triggers/time_pattern.py | 2 +- .../triggers/test_time_pattern.py | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homeassistant/triggers/time_pattern.py b/homeassistant/components/homeassistant/triggers/time_pattern.py index adacc939870..5f03fb593d6 100644 --- a/homeassistant/components/homeassistant/triggers/time_pattern.py +++ b/homeassistant/components/homeassistant/triggers/time_pattern.py @@ -36,7 +36,7 @@ class TimePattern: if isinstance(value, str) and value.startswith("/"): number = int(value[1:]) else: - number = int(value) + value = number = int(value) if not (0 <= number <= self.maximum): raise vol.Invalid(f"must be a value between 0 and {self.maximum}") diff --git a/tests/components/homeassistant/triggers/test_time_pattern.py b/tests/components/homeassistant/triggers/test_time_pattern.py index 0ef071aadb6..3d32748c176 100644 --- a/tests/components/homeassistant/triggers/test_time_pattern.py +++ b/tests/components/homeassistant/triggers/test_time_pattern.py @@ -1,4 +1,6 @@ """The tests for the time_pattern automation.""" +from datetime import timedelta + import pytest import voluptuous as vol @@ -123,6 +125,39 @@ async def test_if_fires_when_second_matches(hass, calls): assert len(calls) == 1 +async def test_if_fires_when_second_as_string_matches(hass, calls): + """Test for firing if seconds are matching.""" + now = dt_util.utcnow() + time_that_will_not_match_right_away = dt_util.utcnow().replace( + year=now.year + 1, second=15 + ) + with patch( + "homeassistant.util.dt.utcnow", return_value=time_that_will_not_match_right_away + ): + assert await async_setup_component( + hass, + automation.DOMAIN, + { + automation.DOMAIN: { + "trigger": { + "platform": "time_pattern", + "hours": "*", + "minutes": "*", + "seconds": "30", + }, + "action": {"service": "test.automation"}, + } + }, + ) + + async_fire_time_changed( + hass, time_that_will_not_match_right_away + timedelta(seconds=15) + ) + + await hass.async_block_till_done() + assert len(calls) == 1 + + async def test_if_fires_when_all_matches(hass, calls): """Test for firing if everything matches.""" now = dt_util.utcnow() From fe056f518e1f1467b74f5c34aea49cd7e0d49847 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 23 Sep 2020 13:55:32 -0500 Subject: [PATCH 18/25] Ensure group state is recalculated when re-adding on reload (#40497) --- homeassistant/components/group/cover.py | 6 +++++- homeassistant/components/group/light.py | 7 ++++++- tests/components/group/test_light.py | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/group/cover.py b/homeassistant/components/group/cover.py index b0d0b8b7bd2..ab2ad65713d 100644 --- a/homeassistant/components/group/cover.py +++ b/homeassistant/components/group/cover.py @@ -39,7 +39,7 @@ from homeassistant.const import ( STATE_OPEN, STATE_OPENING, ) -from homeassistant.core import State +from homeassistant.core import CoreState, State import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_state_change_event @@ -162,6 +162,10 @@ class CoverGroup(GroupEntity, CoverEntity): self.hass, self._entities, self._update_supported_features_event ) ) + + if self.hass.state == CoreState.running: + await self.async_update() + return await super().async_added_to_hass() @property diff --git a/homeassistant/components/group/light.py b/homeassistant/components/group/light.py index 289bb8df3f0..007e05edfbb 100644 --- a/homeassistant/components/group/light.py +++ b/homeassistant/components/group/light.py @@ -36,7 +36,7 @@ from homeassistant.const import ( STATE_ON, STATE_UNAVAILABLE, ) -from homeassistant.core import State +from homeassistant.core import CoreState, State import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_state_change_event from homeassistant.helpers.typing import ConfigType, HomeAssistantType @@ -111,6 +111,11 @@ class LightGroup(GroupEntity, light.LightEntity): self.hass, self._entity_ids, async_state_changed_listener ) ) + + if self.hass.state == CoreState.running: + await self.async_update() + return + await super().async_added_to_hass() @property diff --git a/tests/components/group/test_light.py b/tests/components/group/test_light.py index a22c56b4bfc..ba8fecbed32 100644 --- a/tests/components/group/test_light.py +++ b/tests/components/group/test_light.py @@ -737,6 +737,11 @@ async def test_reload_with_base_integration_platform_not_setup(hass): }, ) await hass.async_block_till_done() + hass.states.async_set("light.master_hall_lights", STATE_ON) + hass.states.async_set("light.master_hall_lights_2", STATE_OFF) + + hass.states.async_set("light.outside_patio_lights", STATE_OFF) + hass.states.async_set("light.outside_patio_lights_2", STATE_OFF) yaml_path = path.join( _get_fixtures_base_path(), @@ -755,6 +760,8 @@ async def test_reload_with_base_integration_platform_not_setup(hass): assert hass.states.get("light.light_group") is None assert hass.states.get("light.master_hall_lights_g") is not None assert hass.states.get("light.outside_patio_lights_g") is not None + assert hass.states.get("light.master_hall_lights_g").state == STATE_ON + assert hass.states.get("light.outside_patio_lights_g").state == STATE_OFF def _get_fixtures_base_path(): From ff39cd753c415dc332d104994bc056b057459d80 Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:35:52 +0800 Subject: [PATCH 19/25] Disable audio in stream when audio stream profile is None (#40521) --- homeassistant/components/stream/worker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/stream/worker.py b/homeassistant/components/stream/worker.py index 40231d87a53..9e036a764f8 100644 --- a/homeassistant/components/stream/worker.py +++ b/homeassistant/components/stream/worker.py @@ -77,6 +77,9 @@ def _stream_worker_internal(hass, stream, quit_event): # compatible with empty_moov and manual bitstream filters not in PyAV if container.format.name in {"hls", "mpegts"}: audio_stream = None + # Some audio streams do not have a profile and throw errors when remuxing + if audio_stream and audio_stream.profile is None: + audio_stream = None # The presentation timestamps of the first packet in each stream we receive # Use to adjust before muxing or outputting, but we don't adjust internally From a404c51797597087d3ae85c1d1d85178ed90cee9 Mon Sep 17 00:00:00 2001 From: cagnulein Date: Fri, 25 Sep 2020 09:06:24 +0200 Subject: [PATCH 20/25] Fix luci device_tracker when release is none (#40524) Co-authored-by: Martin Hjelmare --- homeassistant/components/luci/device_tracker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/luci/device_tracker.py b/homeassistant/components/luci/device_tracker.py index 40b111d0d83..d4fb1d5f7bc 100644 --- a/homeassistant/components/luci/device_tracker.py +++ b/homeassistant/components/luci/device_tracker.py @@ -96,6 +96,7 @@ class LuciDeviceScanner(DeviceScanner): for device in result: if ( not hasattr(self.router.router.owrt_version, "release") + or not self.router.router.owrt_version.release or self.router.router.owrt_version.release[0] < 19 or device.reachable ): From 82c137d69b066c0814d51a77f542723cec0ab35c Mon Sep 17 00:00:00 2001 From: Steven Looman Date: Thu, 24 Sep 2020 18:27:55 +0200 Subject: [PATCH 21/25] Increase upnp timeout from 5 seconds to 10 seconds (#40540) --- homeassistant/components/upnp/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/upnp/device.py b/homeassistant/components/upnp/device.py index c4a81db1ff4..5f29043a1fe 100644 --- a/homeassistant/components/upnp/device.py +++ b/homeassistant/components/upnp/device.py @@ -67,7 +67,7 @@ class Device: """Create UPnP/IGD device.""" # build async_upnp_client requester session = async_get_clientsession(hass) - requester = AiohttpSessionRequester(session, True) + requester = AiohttpSessionRequester(session, True, 10) # create async_upnp_client device factory = UpnpFactory(requester, disable_state_variable_validation=True) From 6bd72c3ff5609cbeda99ce41c3d180a6e3ff6262 Mon Sep 17 00:00:00 2001 From: Rob Bierbooms Date: Thu, 24 Sep 2020 22:50:30 +0200 Subject: [PATCH 22/25] Fix connection validation during import for dsmr integration (#40548) * Close transport when equipment identifier is received * Minor fix --- homeassistant/components/dsmr/config_flow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/dsmr/config_flow.py b/homeassistant/components/dsmr/config_flow.py index d0d0304a02a..724f9393fbf 100644 --- a/homeassistant/components/dsmr/config_flow.py +++ b/homeassistant/components/dsmr/config_flow.py @@ -48,9 +48,9 @@ class DSMRConnection: """Test if we can validate connection with the device.""" def update_telegram(telegram): - self._telegram = telegram - - transport.close() + if obis_ref.EQUIPMENT_IDENTIFIER in telegram: + self._telegram = telegram + transport.close() if self._host is None: reader_factory = partial( From da7f206414d2bb43e0e3ecfce5685b10fe4764eb Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 24 Sep 2020 22:43:34 +0200 Subject: [PATCH 23/25] Updated frontend to 20200918.2 (#40549) --- 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 4368bff8d0f..d0c86f2cdf5 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -2,7 +2,7 @@ "domain": "frontend", "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", - "requirements": ["home-assistant-frontend==20200918.0"], + "requirements": ["home-assistant-frontend==20200918.2"], "dependencies": [ "api", "auth", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 0f88f88469b..0894039d99a 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -13,7 +13,7 @@ defusedxml==0.6.0 distro==1.5.0 emoji==0.5.4 hass-nabucasa==0.37.0 -home-assistant-frontend==20200918.0 +home-assistant-frontend==20200918.2 importlib-metadata==1.6.0;python_version<'3.8' jinja2>=2.11.2 netdisco==2.8.2 diff --git a/requirements_all.txt b/requirements_all.txt index 3d3bd4ace9e..1ec5be4ab3a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -747,7 +747,7 @@ hole==0.5.1 holidays==0.10.3 # homeassistant.components.frontend -home-assistant-frontend==20200918.0 +home-assistant-frontend==20200918.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 911da004e3c..d904e74a08c 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -370,7 +370,7 @@ hole==0.5.1 holidays==0.10.3 # homeassistant.components.frontend -home-assistant-frontend==20200918.0 +home-assistant-frontend==20200918.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 From 1c8e8419b636558800b101c0ade5e379f06861d3 Mon Sep 17 00:00:00 2001 From: Kevin Cathcart Date: Fri, 25 Sep 2020 03:15:04 -0400 Subject: [PATCH 24/25] Fix bug in state trigger when using for: without to: (#40556) --- .../homeassistant/triggers/state.py | 2 +- .../homeassistant/triggers/test_state.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homeassistant/triggers/state.py b/homeassistant/components/homeassistant/triggers/state.py index f57db0ed56a..a7377ffe43e 100644 --- a/homeassistant/components/homeassistant/triggers/state.py +++ b/homeassistant/components/homeassistant/triggers/state.py @@ -145,7 +145,7 @@ async def async_attach_trigger( else: cur_value = new_st.attributes.get(attribute) - if CONF_TO not in config: + if CONF_FROM in config and CONF_TO not in config: return cur_value != old_value return cur_value == new_value diff --git a/tests/components/homeassistant/triggers/test_state.py b/tests/components/homeassistant/triggers/test_state.py index ce9ecaba1b0..990fc9cc956 100644 --- a/tests/components/homeassistant/triggers/test_state.py +++ b/tests/components/homeassistant/triggers/test_state.py @@ -538,6 +538,39 @@ async def test_if_fires_on_entity_change_with_for_without_to(hass, calls): assert len(calls) == 1 +async def test_if_does_not_fires_on_entity_change_with_for_without_to_2(hass, calls): + """Test for firing on entity change with for.""" + assert await async_setup_component( + hass, + automation.DOMAIN, + { + automation.DOMAIN: { + "trigger": { + "platform": "state", + "entity_id": "test.entity", + "for": {"seconds": 5}, + }, + "action": {"service": "test.automation"}, + } + }, + ) + await hass.async_block_till_done() + + utcnow = dt_util.utcnow() + with patch("homeassistant.core.dt_util.utcnow") as mock_utcnow: + mock_utcnow.return_value = utcnow + + for i in range(10): + hass.states.async_set("test.entity", str(i)) + await hass.async_block_till_done() + + mock_utcnow.return_value += timedelta(seconds=1) + async_fire_time_changed(hass, mock_utcnow.return_value) + await hass.async_block_till_done() + + assert len(calls) == 0 + + async def test_if_fires_on_entity_creation_and_removal(hass, calls): """Test for firing on entity creation and removal, with to/from constraints.""" # set automations for multiple combinations to/from From 7be494f8453ab95e9441dd7e2c85fbd328dd8c31 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 25 Sep 2020 09:28:38 +0200 Subject: [PATCH 25/25] Bumped version to 0.115.3 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 818f4a715a4..86a73b5308e 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 115 -PATCH_VERSION = "2" +PATCH_VERSION = "3" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 1)