mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
Do not crash on missing geolocation (#701)
If 'has_set_location_info' is false, the geolocation is missing.
This commit is contained in:
parent
f7c04bcef8
commit
aecf0ecd8a
@ -147,8 +147,8 @@ class TapoDevice(SmartDevice):
|
|||||||
def location(self) -> Dict:
|
def location(self) -> Dict:
|
||||||
"""Return the device location."""
|
"""Return the device location."""
|
||||||
loc = {
|
loc = {
|
||||||
"latitude": cast(float, self._info.get("latitude")) / 10_000,
|
"latitude": cast(float, self._info.get("latitude", 0)) / 10_000,
|
||||||
"longitude": cast(float, self._info.get("longitude")) / 10_000,
|
"longitude": cast(float, self._info.get("longitude", 0)) / 10_000,
|
||||||
}
|
}
|
||||||
return loc
|
return loc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user