Tado unavailable state to device tracker (#107542)

* Adding unavailable state to device tracker

* Small fixes
This commit is contained in:
Erwin Douna 2024-01-09 08:18:22 +01:00 committed by GitHub
parent a0b00d78b1
commit 9ca09bd6f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,6 +123,7 @@ class TadoDeviceTrackerEntity(TrackerEntity):
"""A Tado Device Tracker entity."""
_attr_should_poll = False
_attr_available = False
def __init__(
self,
@ -150,6 +151,17 @@ class TadoDeviceTrackerEntity(TrackerEntity):
)
device = self._tado.data["mobile_device"][self._device_id]
self._attr_available = False
_LOGGER.debug(
"Tado device %s has geoTracking state %s",
device["name"],
device["settings"]["geoTrackingEnabled"],
)
if device["settings"]["geoTrackingEnabled"] is False:
return
self._attr_available = True
self._active = False
if device.get("location") is not None and device["location"]["atHome"]:
_LOGGER.debug("Tado device %s is at home", device["name"])