diff --git a/custom_components/webastoconnect/const.py b/custom_components/webastoconnect/const.py index 4737e6c..cf72556 100644 --- a/custom_components/webastoconnect/const.py +++ b/custom_components/webastoconnect/const.py @@ -19,3 +19,5 @@ NEW_DATA = "webasto_signal" ATTR_COORDINATOR = "updatecoordinator" +ATTR_SPEED = "speed" +ATTR_DIRECTION = "direction" \ No newline at end of file diff --git a/custom_components/webastoconnect/device_tracker.py b/custom_components/webastoconnect/device_tracker.py index aa51a9d..710d341 100644 --- a/custom_components/webastoconnect/device_tracker.py +++ b/custom_components/webastoconnect/device_tracker.py @@ -14,7 +14,7 @@ from homeassistant.util import slugify as util_slugify from .api import WebastoConnectUpdateCoordinator -from .const import ATTR_COORDINATOR, DOMAIN +from .const import ATTR_COORDINATOR, ATTR_DIRECTION, ATTR_SPEED, DOMAIN LOGGER = logging.getLogger(__name__) @@ -75,6 +75,16 @@ def __init__( util_slugify(f"{self.coordinator.cloud.name} {self._attr_name}") ) + self._attributes = { + ATTR_DIRECTION: self.coordinator.cloud.heading, + ATTR_SPEED: self.coordinator.cloud.speed, + } + + @property + def extra_state_attributes(self): + """Return device specific attributes.""" + return self._attributes + @property def available(self) -> bool: """Handle the location states.""" @@ -94,6 +104,12 @@ def _handle_coordinator_update(self) -> None: ): self._prev_lat = self.coordinator.cloud.location["lat"] self._prev_lon = self.coordinator.cloud.location["lon"] + + self._attributes = { + ATTR_DIRECTION: self.coordinator.cloud.heading, + ATTR_SPEED: self.coordinator.cloud.speed, + } + self.async_write_ha_state() @property diff --git a/custom_components/webastoconnect/manifest.json b/custom_components/webastoconnect/manifest.json index 3e58b7d..99d7d6a 100644 --- a/custom_components/webastoconnect/manifest.json +++ b/custom_components/webastoconnect/manifest.json @@ -12,7 +12,7 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/MTrab/webastoconnect/issues", "requirements": [ - "pywebasto==1.0.0" + "pywebasto==1.0.3" ], "version": "0.2.0" } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2c14b65..d9c02b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ colorlog==6.8.2 -homeassistant==2024.2.2 +homeassistant==2024.3.2 pip>=21.0,<24.1 ruff==0.3.2