def get_devices(self): '''Get the list of registered locks''' api_url_lock = "https://api.tedee.com/api/v1.15/my/lock" r = requests.get(api_url_lock, headers=self._api_header, timeout=self._timeout) _LOGGER.debug("Locks %s", r.json()) result = r.json()["result"] for x in result: id = x["id"] name = x["name"] isConnected = x["isConnected"] state = x["lockProperties"]["state"] batteryLevel = x["lockProperties"]["batteryLevel"] isCharging = x["lockProperties"]["isCharging"] isEnabledPullSpring =x["deviceSettings"]["pullSpringEnabled"] durationPullSpring =x["deviceSettings"]["pullSpringDuration"] lock = Lock(name, id) lock.set_connected(isConnected) lock.set_state(state) lock.set_battery_level(batteryLevel) lock.set_is_charging(isCharging) lock.set_is_enabled_pullspring(isEnabledPullSpring) lock.set_duration_pullspring(durationPullSpring) self._lock_id = id '''store the found lock in _sensor_list and get the battery_level''' self._sensor_list.append(lock) if self._lock_id == None: raise TedeeClientException("No lock found")