From 6ab46654f3158f765571380f6928bb16baa85896 Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Fri, 4 Jun 2021 16:03:25 +0200 Subject: [PATCH] fix error on GATEWAY_MODEL_ZIG3 when no zigbee devices connected (#1065) * fix error on GATEWAY_MODEL_ZIG3 when no zigbee devices connected * clean up * black formatting --- miio/gateway/gateway.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/miio/gateway/gateway.py b/miio/gateway/gateway.py index f22fe4e56..999962a0a 100644 --- a/miio/gateway/gateway.py +++ b/miio/gateway/gateway.py @@ -170,6 +170,12 @@ def discover_devices(self): # self.send("get_device_list") does work for the GATEWAY_MODEL_ZIG3 but gives slightly diffrent return values devices_raw = self.send("get_device_list") + if type(devices_raw) != list: + _LOGGER.debug( + "Gateway response to 'get_device_list' not a list type, no zigbee devices connected." + ) + return self._devices + for device in devices_raw: # Match 'model' to get the model_info model_info = self.match_zigbee_model(device["model"], device["did"])