From 7cb0c98c03919af95865930b77506998e2a99c4b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 17 Sep 2020 14:45:30 -0500 Subject: [PATCH 01/10] Log template listeners when debug logging is on (#40180) --- homeassistant/helpers/event.py | 14 ++++++++++++++ tests/helpers/test_event.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 435a265d9e0..3033b51b605 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -525,6 +525,11 @@ class _TrackTemplateResultInfo: self._last_info = self._info.copy() self._create_listeners() + _LOGGER.debug( + "Template group %s listens for %s", + self._track_templates, + self.listeners, + ) @property def listeners(self) -> Dict: @@ -683,6 +688,10 @@ class _TrackTemplateResultInfo: ): continue + _LOGGER.debug( + "Template update %s triggered by event: %s", template.template, event + ) + self._info[template] = template.async_render_to_info( track_template_.variables ) @@ -708,6 +717,11 @@ class _TrackTemplateResultInfo: if info_changed: self._update_listeners() + _LOGGER.debug( + "Template group %s listens for %s", + self._track_templates, + self.listeners, + ) self._last_info = self._info.copy() if not updates: diff --git a/tests/helpers/test_event.py b/tests/helpers/test_event.py index ba14c8a757f..ced25f1ad5b 100644 --- a/tests/helpers/test_event.py +++ b/tests/helpers/test_event.py @@ -541,7 +541,7 @@ async def test_track_template_error(hass, caplog): hass.states.async_set("switch.not_exist", "off") await hass.async_block_till_done() - assert "lunch" not in caplog.text + assert "no filter named 'lunch'" not in caplog.text assert "TemplateAssertionError" not in caplog.text From b8fe0c6c3a4d3ae50e2857ced97b35901237f194 Mon Sep 17 00:00:00 2001 From: Julius Mittenzwei Date: Fri, 18 Sep 2020 03:18:55 +0200 Subject: [PATCH 02/10] Upgrade pyvlx to 0.2.17 (#40182) --- homeassistant/components/velux/manifest.json | 2 +- requirements_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/velux/manifest.json b/homeassistant/components/velux/manifest.json index 73306bca7b5..0fdbfb64999 100644 --- a/homeassistant/components/velux/manifest.json +++ b/homeassistant/components/velux/manifest.json @@ -2,6 +2,6 @@ "domain": "velux", "name": "Velux", "documentation": "https://www.home-assistant.io/integrations/velux", - "requirements": ["pyvlx==0.2.16"], + "requirements": ["pyvlx==0.2.17"], "codeowners": ["@Julius2342"] } diff --git a/requirements_all.txt b/requirements_all.txt index 7ff2d0695b5..18d0e6812f1 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1837,7 +1837,7 @@ pyvesync==1.1.0 pyvizio==0.1.56 # homeassistant.components.velux -pyvlx==0.2.16 +pyvlx==0.2.17 # homeassistant.components.volumio pyvolumio==0.1.2 From 0383030266340013d34c8717f452e95151962cd3 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Fri, 18 Sep 2020 07:18:56 -0400 Subject: [PATCH 03/10] Fix Vizio async_unload_entry bug (#40210) --- homeassistant/components/vizio/__init__.py | 2 +- tests/components/vizio/test_init.py | 27 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/vizio/__init__.py b/homeassistant/components/vizio/__init__.py index 25960da72cf..a7a9c404f74 100644 --- a/homeassistant/components/vizio/__init__.py +++ b/homeassistant/components/vizio/__init__.py @@ -94,7 +94,7 @@ async def async_unload_entry( and entry.data[CONF_DEVICE_CLASS] == DEVICE_CLASS_TV for entry in hass.config_entries.async_entries(DOMAIN) ): - hass.data[DOMAIN].pop(CONF_APPS) + hass.data[DOMAIN].pop(CONF_APPS, None) if not hass.data[DOMAIN]: hass.data.pop(DOMAIN) diff --git a/tests/components/vizio/test_init.py b/tests/components/vizio/test_init.py index 33764de8696..cd611662597 100644 --- a/tests/components/vizio/test_init.py +++ b/tests/components/vizio/test_init.py @@ -6,7 +6,7 @@ from homeassistant.components.vizio.const import DOMAIN from homeassistant.helpers.typing import HomeAssistantType from homeassistant.setup import async_setup_component -from .const import MOCK_USER_VALID_TV_CONFIG, UNIQUE_ID +from .const import MOCK_SPEAKER_CONFIG, MOCK_USER_VALID_TV_CONFIG, UNIQUE_ID from tests.common import MockConfigEntry @@ -24,12 +24,12 @@ async def test_setup_component( assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 1 -async def test_load_and_unload( +async def test_tv_load_and_unload( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: - """Test loading and unloading entry.""" + """Test loading and unloading TV entry.""" config_entry = MockConfigEntry( domain=DOMAIN, data=MOCK_USER_VALID_TV_CONFIG, unique_id=UNIQUE_ID ) @@ -43,3 +43,24 @@ async def test_load_and_unload( await hass.async_block_till_done() assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 0 assert DOMAIN not in hass.data + + +async def test_speaker_load_and_unload( + hass: HomeAssistantType, + vizio_connect: pytest.fixture, + vizio_update: pytest.fixture, +) -> None: + """Test loading and unloading speaker entry.""" + config_entry = MockConfigEntry( + domain=DOMAIN, data=MOCK_SPEAKER_CONFIG, unique_id=UNIQUE_ID + ) + config_entry.add_to_hass(hass) + assert await hass.config_entries.async_setup(config_entry.entry_id) + await hass.async_block_till_done() + assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 1 + assert DOMAIN in hass.data + + assert await config_entry.async_unload(hass) + await hass.async_block_till_done() + assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 0 + assert DOMAIN not in hass.data From 33b56b0cf92adf6900535415266171b1c9dfbe8c Mon Sep 17 00:00:00 2001 From: MeIchthys <10717998+meichthys@users.noreply.github.com> Date: Fri, 18 Sep 2020 09:34:17 -0400 Subject: [PATCH 04/10] Fix Nextcloud sensors becoming unavailable (#40212) --- homeassistant/components/nextcloud/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/nextcloud/__init__.py b/homeassistant/components/nextcloud/__init__.py index 12c17e6081d..ff94fd708db 100644 --- a/homeassistant/components/nextcloud/__init__.py +++ b/homeassistant/components/nextcloud/__init__.py @@ -100,7 +100,6 @@ 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.""" @@ -111,6 +110,7 @@ def setup(hass, config): return False hass.data[DOMAIN] = get_data_points(ncm.data) + hass.data[DOMAIN]["instance"] = conf[CONF_URL] # Update sensors on time interval track_time_interval(hass, nextcloud_update, conf[CONF_SCAN_INTERVAL]) From d37fe1fbb629bc83929713440ef148c41582ed83 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Fri, 18 Sep 2020 09:32:38 -0400 Subject: [PATCH 05/10] Disable async on Apprise (#40213) --- homeassistant/components/apprise/notify.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/apprise/notify.py b/homeassistant/components/apprise/notify.py index 0c8c5b26eec..f999da94531 100644 --- a/homeassistant/components/apprise/notify.py +++ b/homeassistant/components/apprise/notify.py @@ -29,8 +29,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def get_service(hass, config, discovery_info=None): """Get the Apprise notification service.""" - # Create our object - a_obj = apprise.Apprise() + # Create our Apprise Asset Object + asset = apprise.AppriseAsset(async_mode=False) + + # Create our Apprise Instance (reference our asset) + a_obj = apprise.Apprise(asset=asset) if config.get(CONF_FILE): # Sourced from a Configuration File From 8a39bea7614590f5579359a8b4e6f5f23eec17ff Mon Sep 17 00:00:00 2001 From: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com> Date: Fri, 18 Sep 2020 10:31:25 -0300 Subject: [PATCH 06/10] Fix RM mini 3 update manager (#40215) --- homeassistant/components/broadlink/updater.py | 22 +++++++++++++++++++ tests/components/broadlink/__init__.py | 3 +++ tests/components/broadlink/test_device.py | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/broadlink/updater.py b/homeassistant/components/broadlink/updater.py index bd124d1e1ac..8b6f1316f52 100644 --- a/homeassistant/components/broadlink/updater.py +++ b/homeassistant/components/broadlink/updater.py @@ -1,12 +1,15 @@ """Support for fetching data from Broadlink devices.""" from abc import ABC, abstractmethod from datetime import timedelta +from functools import partial import logging +import broadlink as blk from broadlink.exceptions import ( AuthorizationError, BroadlinkException, CommandNotSupportedError, + DeviceOfflineError, StorageError, ) @@ -18,6 +21,9 @@ _LOGGER = logging.getLogger(__name__) def get_update_manager(device): """Return an update manager for a given Broadlink device.""" + if device.api.model.startswith("RM mini"): + return BroadlinkRMMini3UpdateManager(device) + update_managers = { "A1": BroadlinkA1UpdateManager, "MP1": BroadlinkMP1UpdateManager, @@ -95,6 +101,22 @@ class BroadlinkMP1UpdateManager(BroadlinkUpdateManager): return await self.device.async_request(self.device.api.check_power) +class BroadlinkRMMini3UpdateManager(BroadlinkUpdateManager): + """Manages updates for Broadlink RM mini 3 devices.""" + + async def async_fetch_data(self): + """Fetch data from the device.""" + hello = partial( + blk.discover, + discover_ip_address=self.device.api.host[0], + timeout=self.device.api.timeout, + ) + devices = await self.device.hass.async_add_executor_job(hello) + if not devices: + raise DeviceOfflineError("The device is offline") + return {} + + class BroadlinkRMUpdateManager(BroadlinkUpdateManager): """Manages updates for Broadlink RM2 and RM4 devices.""" diff --git a/tests/components/broadlink/__init__.py b/tests/components/broadlink/__init__.py index 4051f94c0d3..95a2ef97c6f 100644 --- a/tests/components/broadlink/__init__.py +++ b/tests/components/broadlink/__init__.py @@ -85,6 +85,9 @@ class BroadlinkDevice: with patch( "homeassistant.components.broadlink.device.blk.gendevice", return_value=mock_api, + ), patch( + "homeassistant.components.broadlink.updater.blk.discover", + return_value=[mock_api], ): await hass.config_entries.async_setup(mock_entry.entry_id) await hass.async_block_till_done() diff --git a/tests/components/broadlink/test_device.py b/tests/components/broadlink/test_device.py index 5cd0457b552..5b9d0e77508 100644 --- a/tests/components/broadlink/test_device.py +++ b/tests/components/broadlink/test_device.py @@ -179,7 +179,7 @@ async def test_device_setup_update_authorization_error(hass): async def test_device_setup_update_authentication_error(hass): """Test we handle an authentication error in the update step.""" - device = get_device("Living Room") + device = get_device("Garage") mock_api = device.get_mock_api() mock_api.check_sensors.side_effect = blke.AuthorizationError() mock_api.auth.side_effect = (None, blke.AuthenticationError()) @@ -207,7 +207,7 @@ async def test_device_setup_update_authentication_error(hass): async def test_device_setup_update_broadlink_exception(hass): """Test we handle a Broadlink exception in the update step.""" - device = get_device("Living Room") + device = get_device("Garage") mock_api = device.get_mock_api() mock_api.check_sensors.side_effect = blke.BroadlinkException() mock_entry = device.get_mock_entry() From 152b380a2f16377b7f85bd07c9477e4b4794c297 Mon Sep 17 00:00:00 2001 From: On Freund Date: Fri, 18 Sep 2020 16:24:14 +0300 Subject: [PATCH 07/10] Fix kodi.call_method (#40236) --- homeassistant/components/kodi/media_player.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/kodi/media_player.py b/homeassistant/components/kodi/media_player.py index f13d5301625..a1b9987b5c9 100644 --- a/homeassistant/components/kodi/media_player.py +++ b/homeassistant/components/kodi/media_player.py @@ -714,7 +714,7 @@ class KodiEntity(MediaPlayerEntity): _LOGGER.debug("Run API method %s, kwargs=%s", method, kwargs) result_ok = False try: - result = self._kodi.call_method(method, **kwargs) + result = await self._kodi.call_method(method, **kwargs) result_ok = True except jsonrpc_base.jsonrpc.ProtocolError as exc: result = exc.args[2]["error"] From ef279b125dbbe5fee1c388a1dc9bdeb057d31382 Mon Sep 17 00:00:00 2001 From: On Freund Date: Fri, 18 Sep 2020 16:28:39 +0300 Subject: [PATCH 08/10] Handle systems without groups (#40238) --- homeassistant/components/risco/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/risco/manifest.json b/homeassistant/components/risco/manifest.json index 80b132b0fb2..7f13af252f3 100644 --- a/homeassistant/components/risco/manifest.json +++ b/homeassistant/components/risco/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/risco", "requirements": [ - "pyrisco==0.3.0" + "pyrisco==0.3.1" ], "codeowners": [ "@OnFreund" diff --git a/requirements_all.txt b/requirements_all.txt index 18d0e6812f1..c1b8ac7321e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1595,7 +1595,7 @@ pyrecswitch==1.0.2 pyrepetier==3.0.5 # homeassistant.components.risco -pyrisco==0.3.0 +pyrisco==0.3.1 # homeassistant.components.sabnzbd pysabnzbd==1.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d492e3acbb5..e243b4e62a0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -769,7 +769,7 @@ pyps4-2ndscreen==1.1.1 pyqwikswitch==0.93 # homeassistant.components.risco -pyrisco==0.3.0 +pyrisco==0.3.1 # homeassistant.components.acer_projector # homeassistant.components.zha From e9b355bd8ae510f2f158633550d203cb2f863dbf Mon Sep 17 00:00:00 2001 From: On Freund Date: Fri, 18 Sep 2020 16:28:02 +0300 Subject: [PATCH 09/10] Fix coolmaster.info (#40240) --- homeassistant/components/coolmaster/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/coolmaster/manifest.json b/homeassistant/components/coolmaster/manifest.json index 58bd51fca4d..85bd3b1893f 100644 --- a/homeassistant/components/coolmaster/manifest.json +++ b/homeassistant/components/coolmaster/manifest.json @@ -3,6 +3,6 @@ "name": "CoolMasterNet", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/coolmaster", - "requirements": ["pycoolmasternet-async==0.1.1"], + "requirements": ["pycoolmasternet-async==0.1.2"], "codeowners": ["@OnFreund"] } diff --git a/requirements_all.txt b/requirements_all.txt index c1b8ac7321e..cc83c47950f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1277,7 +1277,7 @@ pycocotools==2.0.1 pycomfoconnect==0.3 # homeassistant.components.coolmaster -pycoolmasternet-async==0.1.1 +pycoolmasternet-async==0.1.2 # homeassistant.components.avri pycountry==19.8.18 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e243b4e62a0..84f2f0c9a64 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -616,7 +616,7 @@ pybotvac==0.0.17 pychromecast==7.2.1 # homeassistant.components.coolmaster -pycoolmasternet-async==0.1.1 +pycoolmasternet-async==0.1.2 # homeassistant.components.avri pycountry==19.8.18 From 2df709c7d03a1df028849e99a87c33d6b21fbf79 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 18 Sep 2020 14:05:11 +0000 Subject: [PATCH 10/10] Bumped version to 0.115.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 80129e097d0..79d91ef7cb2 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 = "0" +PATCH_VERSION = "1" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 1)