Skip to content

Commit

Permalink
fix error on GATEWAY_MODEL_ZIG3 when no zigbee devices connected (#1065)
Browse files Browse the repository at this point in the history
* fix error on GATEWAY_MODEL_ZIG3 when no zigbee devices connected

* clean up

* black formatting
  • Loading branch information
starkillerOG authored Jun 4, 2021
1 parent 0dcea13 commit 6ab4665
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions miio/gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down

0 comments on commit 6ab4665

Please sign in to comment.