Fetch all smartlocks and create Smartlock objects mapped by ID.
Source code in nukiwebapi/nuki_web_api.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 | def _fetch_smartlocks(self):
"""Fetch all smartlocks and create Smartlock objects mapped by ID."""
response = self._request("GET", "/smartlock")
smartlocks = {}
if response.json():
for item in response.json():
smartlock_id = item.get("smartlockId")
if not smartlock_id:
continue # skip invalid entries
smartlock = SmartlockInstance(
client=self,
smartlock_id=smartlock_id,
data=item
)
smartlocks[smartlock_id] = smartlock
return smartlocks
|