From 865e5eeed32ca283f7878e5b3781994e83f81aec Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 23 Dec 2024 10:05:47 +1000 Subject: [PATCH] fix device tracker --- custom_components/teslemetry/device_tracker.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/custom_components/teslemetry/device_tracker.py b/custom_components/teslemetry/device_tracker.py index 1aa7d7c..fa8b82a 100644 --- a/custom_components/teslemetry/device_tracker.py +++ b/custom_components/teslemetry/device_tracker.py @@ -112,8 +112,6 @@ def __init__( def _async_value_from_stream(self, value) -> None: """Update the value of the entity.""" - if isinstance(value, dict): - self._attr_latitude = value["latitude"] - self._attr_longitude = value["longitude"] - self._attr_available = True - self._attr_available = False + self._attr_available = isinstance(value, dict) + self._attr_latitude = value.get("latitude") + self._attr_longitude = value.get("longitude")