8000 Do not crash on missing geolocation (#701) · python-kasa/python-kasa@aecf0ec · GitHub
[go: up one dir, main page]

Skip to content

Commit aecf0ec

Browse files
authored
Do not crash on missing geolocation (#701)
If 'has_set_location_info' is false, the geolocation is missing.
1 parent f7c04bc commit aecf0ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kasa/tapo/tapodevice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def hw_info(self) -> Dict:
147147
def location(self) -> Dict:
148148
"""Return the device location."""
149149
loc = {
150-
"latitude": cast(float, self._info.get("latitude")) / 10_000,
151-
"longitude": cast(float, self._info.get("longitude")) / 10_000,
150+
"latitude": cast(float, self._info.get("latitude", 0)) / 10_000,
151+
"longitude": cast(float, self._info.get("longitude", 0)) / 10_000,
152152
}
153153
return loc
154154

0 commit comments

Comments
 (0)
0