Skip to content

Commit 7caa46d

Browse files
authored
Handle invalid basic data (#202)
1 parent a2f610a commit 7caa46d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

switchbot/devices/lock.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ async def _lock_unlock(
193193
# Also update the battery and firmware version
194194
if basic_data := await self._get_basic_info():
195195
self._last_full_update = time.monotonic()
196-
self._update_parsed_data(self._parse_basic_data(basic_data))
196+
if len(basic_data) >= 3:
197+
self._update_parsed_data(self._parse_basic_data(basic_data))
198+
else:
199+
_LOGGER.warning("Invalid basic data received: %s", basic_data)
197200
self._fire_callbacks()
198201

199202
return status

0 commit comments

Comments
 (0)