From d34c04d9fb003055a98fcb9525ab3feaa9bc0ce9 Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Fri, 29 Mar 2024 11:19:52 +0000 Subject: [PATCH 1/4] Bump pywebasto version --- custom_components/webastoconnect/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 6b759f2e96058c6decd04f0a81b90f20743c4b42 Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Fri, 29 Mar 2024 11:20:06 +0000 Subject: [PATCH 2/4] Bump Home Assistant version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4f12a3d5acdfb7fe9955a03129fd19daacd187da Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Fri, 29 Mar 2024 11:20:18 +0000 Subject: [PATCH 3/4] Add attribute consts --- custom_components/webastoconnect/const.py | 2 ++ 1 file changed, 2 insertions(+) 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 From 56f5828b2245fc59c2189e6627aacf82d297b163 Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Fri, 29 Mar 2024 11:20:34 +0000 Subject: [PATCH 4/4] Add extra attributes speed and heading --- .../webastoconnect/device_tracker.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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