Add GPS satellites count to Starline sensor (#105740)

* GPS Satellites count Starline sensor

* Update homeassistant/components/starline/sensor.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/starline/strings.json

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Capitalise units

* Revert capitalisation

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Dave T <17680170+davet2001@users.noreply.github.com>
This commit is contained in:
Nikolay Vasilchuk 2023-12-29 12:29:06 +03:00 committed by GitHub
parent a4e9a053c7
commit c2cfc8ab46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -99,6 +99,9 @@
},
"mileage": {
"name": "Mileage"
},
"gps_count": {
"name": "GPS satellites"
}
},
"switch": {