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( 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 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) 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 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) 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/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) 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,