From 36c3c624e7079ee698ea5ae97b2402d641b84345 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Wed, 6 May 2020 14:08:43 +0200 Subject: [PATCH 1/7] Add retry on empty modbus messages for serial protocol (#34678) --- homeassistant/components/modbus/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index 34a396758cb..0a7ea08543a 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -188,6 +188,7 @@ class ModbusHub: bytesize=self._config_bytesize, parity=self._config_parity, timeout=self._config_timeout, + retry_on_empty=True, ) elif self._config_type == "rtuovertcp": self._client = ModbusTcpClient( From 4bf45cd2ea2b090c6247801af5ae5bbf193062b8 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Wed, 6 May 2020 14:07:09 +0200 Subject: [PATCH 2/7] Change Modbus switch to use verify_register when defined (#34679) --- homeassistant/components/modbus/switch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/modbus/switch.py b/homeassistant/components/modbus/switch.py index 97a5d00a30f..0d5a32c45e0 100644 --- a/homeassistant/components/modbus/switch.py +++ b/homeassistant/components/modbus/switch.py @@ -273,10 +273,12 @@ class ModbusRegisterSwitch(ModbusCoilSwitch): def _read_register(self) -> Optional[int]: try: if self._register_type == CALL_TYPE_REGISTER_INPUT: - result = self._hub.read_input_registers(self._slave, self._register, 1) + result = self._hub.read_input_registers( + self._slave, self._verify_register, 1 + ) else: result = self._hub.read_holding_registers( - self._slave, self._register, 1 + self._slave, self._verify_register, 1 ) except ConnectionException: self._available = False From b42590c5a9e737f53e76d5f794108dbc048af5f7 Mon Sep 17 00:00:00 2001 From: escoand Date: Tue, 5 May 2020 02:50:59 +0200 Subject: [PATCH 3/7] Catch samsungtv timeout exception (#35205) --- homeassistant/components/samsungtv/bridge.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/samsungtv/bridge.py b/homeassistant/components/samsungtv/bridge.py index a0f16e91cf5..472ce894e1a 100644 --- a/homeassistant/components/samsungtv/bridge.py +++ b/homeassistant/components/samsungtv/bridge.py @@ -259,4 +259,6 @@ class SamsungTVWSBridge(SamsungTVBridge): except ConnectionFailure: self._notify_callback() raise + except WebSocketException: + self._remote = None return self._remote From 1a52632b6844e4e07e4ca4de748b016e3dd00632 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Tue, 5 May 2020 13:56:32 -0600 Subject: [PATCH 4/7] Broader Notion exception handling (#35265) --- homeassistant/components/notion/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/notion/__init__.py b/homeassistant/components/notion/__init__.py index 5e8450ffdea..77ab68d8e70 100644 --- a/homeassistant/components/notion/__init__.py +++ b/homeassistant/components/notion/__init__.py @@ -196,7 +196,14 @@ class Notion: results = await asyncio.gather(*tasks.values(), return_exceptions=True) for attr, result in zip(tasks, results): if isinstance(result, NotionError): - _LOGGER.error("There was an error while updating %s: %s", attr, result) + _LOGGER.error( + "There was a Notion error while updating %s: %s", attr, result + ) + continue + if isinstance(result, Exception): + _LOGGER.error( + "There was an unknown error while updating %s: %s", attr, result + ) continue holding_pen = getattr(self, attr) From 651824947030fc9419f504b623d4709e2ee1c11c Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Thu, 7 May 2020 00:35:04 +0200 Subject: [PATCH 5/7] UniFi - Support SSID filter of SSIDs from access points with extra configuration (#35295) --- homeassistant/components/unifi/config_flow.py | 20 +++++++++---- tests/components/unifi/test_config_flow.py | 29 +++++++++++++++++-- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/unifi/config_flow.py b/homeassistant/components/unifi/config_flow.py index 38d37560952..f584a41ae54 100644 --- a/homeassistant/components/unifi/config_flow.py +++ b/homeassistant/components/unifi/config_flow.py @@ -199,12 +199,20 @@ class UnifiOptionsFlowHandler(config_entries.OptionsFlow): self.options.update(user_input) return await self.async_step_client_control() - ssids = list(self.controller.api.wlans) + [ - f"{wlan.name}{wlan.name_combine_suffix}" - for wlan in self.controller.api.wlans.values() - if not wlan.name_combine_enabled - ] - ssid_filter = {ssid: ssid for ssid in sorted(ssids)} + ssids = ( + set(self.controller.api.wlans) + | { + f"{wlan.name}{wlan.name_combine_suffix}" + for wlan in self.controller.api.wlans.values() + if not wlan.name_combine_enabled + } + | { + wlan["name"] + for ap in self.controller.api.devices.values() + for wlan in ap.raw.get("wlan_overrides", []) + } + ) + ssid_filter = {ssid: ssid for ssid in sorted(list(ssids))} return self.async_show_form( step_id="device_tracker", diff --git a/tests/components/unifi/test_config_flow.py b/tests/components/unifi/test_config_flow.py index 920f22a8054..1cebb605b5a 100644 --- a/tests/components/unifi/test_config_flow.py +++ b/tests/components/unifi/test_config_flow.py @@ -33,6 +33,29 @@ from tests.common import MockConfigEntry CLIENTS = [{"mac": "00:00:00:00:00:01"}] +DEVICES = [ + { + "board_rev": 21, + "device_id": "mock-id", + "ip": "10.0.1.1", + "last_seen": 0, + "mac": "00:00:00:00:01:01", + "model": "U7PG2", + "name": "access_point", + "state": 1, + "type": "uap", + "version": "4.0.80.10875", + "wlan_overrides": [ + { + "name": "SSID 3", + "radio": "na", + "radio_name": "wifi1", + "wlan_id": "012345678910111213141516", + }, + ], + } +] + WLANS = [ {"name": "SSID 1"}, {"name": "SSID 2", "name_combine_enabled": False, "name_combine_suffix": "_IOT"}, @@ -319,7 +342,7 @@ async def test_flow_fails_unknown_problem(hass, aioclient_mock): async def test_option_flow(hass): """Test config flow options.""" controller = await setup_unifi_integration( - hass, clients_response=CLIENTS, wlans_response=WLANS + hass, clients_response=CLIENTS, devices_response=DEVICES, wlans_response=WLANS ) result = await hass.config_entries.options.async_init( @@ -335,7 +358,7 @@ async def test_option_flow(hass): CONF_TRACK_CLIENTS: False, CONF_TRACK_WIRED_CLIENTS: False, CONF_TRACK_DEVICES: False, - CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT"], + CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3"], CONF_DETECTION_TIME: 100, }, ) @@ -360,7 +383,7 @@ async def test_option_flow(hass): CONF_TRACK_CLIENTS: False, CONF_TRACK_WIRED_CLIENTS: False, CONF_TRACK_DEVICES: False, - CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT"], + CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3"], CONF_DETECTION_TIME: 100, CONF_IGNORE_WIRED_BUG: False, CONF_POE_CLIENTS: False, From 7f1793e6a94f2955e44826be69b19cc320331519 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 6 May 2020 18:42:47 -0700 Subject: [PATCH 6/7] Fix SMS doing I/O in event loop (#35313) --- homeassistant/components/sms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sms/__init__.py b/homeassistant/components/sms/__init__.py index 4897ef2844b..b8d46a4aec5 100644 --- a/homeassistant/components/sms/__init__.py +++ b/homeassistant/components/sms/__init__.py @@ -17,7 +17,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +def setup(hass, config): """Configure Gammu state machine.""" conf = config[DOMAIN] device = conf.get(CONF_DEVICE) From 00501019b480af03386880717730b58c33e270de Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 6 May 2020 18:44:00 -0700 Subject: [PATCH 7/7] Bumped version to 0.109.5 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index b4b4041cdda..6b33e58fe02 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 109 -PATCH_VERSION = "4" +PATCH_VERSION = "5" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 0)