Do not crash on missing geolocation (#701)

If 'has_set_location_info' is false, the geolocation is missing.
This commit is contained in:
Teemu R 2024-01-24 13:21:37 +01:00 committed by GitHub
parent f7c04bcef8
commit aecf0ecd8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -147,8 +147,8 @@ class TapoDevice(SmartDevice):
def location(self) -> Dict:
"""Return the device location."""
loc = {
"latitude": cast(float, self._info.get("latitude")) / 10_000,
"longitude": cast(float, self._info.get("longitude")) / 10_000,
"latitude": cast(float, self._info.get("latitude", 0)) / 10_000,
"longitude": cast(float, self._info.get("longitude", 0)) / 10_000,
}
return loc