Add icon to GPSD (#100347)

This commit is contained in:
Jan Rieger 2023-09-14 09:27:16 +02:00 committed by GitHub
parent 923d945267
commit 840d881c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,3 +121,12 @@ class GpsdSensor(SensorEntity):
ATTR_CLIMB: self.agps_thread.data_stream.climb,
ATTR_MODE: self.agps_thread.data_stream.mode,
}
@property
def icon(self) -> str:
"""Return the icon of the sensor."""
mode = self.agps_thread.data_stream.mode
if isinstance(mode, int) and mode >= 2:
return "mdi:crosshairs-gps"
return "mdi:crosshairs"