From c2cfc8ab46d88efe61fa374d302110ab74f12587 Mon Sep 17 00:00:00 2001 From: Nikolay Vasilchuk Date: Fri, 29 Dec 2023 12:29:06 +0300 Subject: [PATCH] Add GPS satellites count to Starline sensor (#105740) * GPS Satellites count Starline sensor * Update homeassistant/components/starline/sensor.py Co-authored-by: Joost Lekkerkerker * Update homeassistant/components/starline/strings.json Co-authored-by: Joost Lekkerkerker * Capitalise units * Revert capitalisation --------- Co-authored-by: Joost Lekkerkerker Co-authored-by: Dave T <17680170+davet2001@users.noreply.github.com> --- homeassistant/components/starline/sensor.py | 8 ++++++++ homeassistant/components/starline/strings.json | 3 +++ 2 files changed, 11 insertions(+) diff --git a/homeassistant/components/starline/sensor.py b/homeassistant/components/starline/sensor.py index 603cceec222..1a43601940e 100644 --- a/homeassistant/components/starline/sensor.py +++ b/homeassistant/components/starline/sensor.py @@ -70,6 +70,12 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( device_class=SensorDeviceClass.DISTANCE, icon="mdi:counter", ), + SensorEntityDescription( + key="gps_count", + translation_key="gps_count", + icon="mdi:satellite-variant", + native_unit_of_measurement="satellites", + ), ) @@ -132,6 +138,8 @@ class StarlineSensor(StarlineEntity, SensorEntity): return self._device.errors.get("val") if self._key == "mileage" and self._device.mileage: return self._device.mileage.get("val") + if self._key == "gps_count" and self._device.position: + return self._device.position["sat_qty"] return None @property diff --git a/homeassistant/components/starline/strings.json b/homeassistant/components/starline/strings.json index 9631dbf7479..6f0c42f0882 100644 --- a/homeassistant/components/starline/strings.json +++ b/homeassistant/components/starline/strings.json @@ -99,6 +99,9 @@ }, "mileage": { "name": "Mileage" + }, + "gps_count": { + "name": "GPS satellites" } }, "switch": {