diff --git a/RELEASE.md b/RELEASE.md index 0be31f89..f7086d9f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -4,6 +4,7 @@ * PyPI 1.12.9 * Add graceful handling of issue where urllib3 v2.0 causes `ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+` error. See https://github.com/jasonacox/tinytuya/issues/377. +* Fix bug in Cloud getdevices() that can error with older `devices.json` versions as raised in https://github.com/jasonacox/tinytuya/issues/381 ## v1.12.8 - Device DP Mapping diff --git a/tinytuya/Cloud.py b/tinytuya/Cloud.py index d5c2869c..249d80ee 100644 --- a/tinytuya/Cloud.py +++ b/tinytuya/Cloud.py @@ -469,7 +469,7 @@ def getdevices(self, verbose=False, oldlist=[], include_map=False): changed_devices = [] unchanged_devices = [] - # chect to see if anything has changed. if so, re-download factory-infos and DP mapping + # check to see if anything has changed. if so, re-download factory-infos and DP mapping for dev in devs: dev_id = dev['id'] if dev_id not in old_devices: @@ -487,7 +487,7 @@ def getdevices(self, verbose=False, oldlist=[], include_map=False): continue is_same = True for k in DEVICEFILE_SAVE_VALUES: - if k in dev and k != 'icon' and k != 'last_ip' and old[k] != dev[k]: + if k in dev and k != 'icon' and k != 'last_ip' and (k not in old or old[k] != dev[k]): is_same = False break if not is_same: