Add icon translations to Private BLE Device (#112185)

This commit is contained in:
Joost Lekkerkerker 2024-03-04 15:44:58 +01:00 committed by GitHub
parent 15fa302c9a
commit a2b9f59b8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 7 deletions

View File

@ -31,6 +31,7 @@ class BasePrivateDeviceTracker(BasePrivateDeviceEntity, BaseTrackerEntity):
_attr_should_poll = False
_attr_has_entity_name = True
_attr_translation_key = "device_tracker"
_attr_name = None
@property
@ -68,8 +69,3 @@ class BasePrivateDeviceTracker(BasePrivateDeviceEntity, BaseTrackerEntity):
def source_type(self) -> SourceType:
"""Return the source type, eg gps or router, of the device."""
return SourceType.BLUETOOTH_LE
@property
def icon(self) -> str:
"""Return device icon."""
return "mdi:bluetooth-connect" if self._last_info else "mdi:bluetooth-off"

View File

@ -0,0 +1,20 @@
{
"entity": {
"device_tracker": {
"device_tracker": {
"default": "mdi:bluetooth-off",
"state": {
"home": "mdi:bluetooth-connect"
}
}
},
"sensor": {
"estimated_distance": {
"default": "mdi:signal-distance-variant"
},
"estimated_broadcast_interval": {
"default": "mdi:timer-sync-outline"
}
}
}
}

View File

@ -65,7 +65,6 @@ SENSOR_DESCRIPTIONS = (
PrivateDeviceSensorEntityDescription(
key="estimated_distance",
translation_key="estimated_distance",
icon="mdi:signal-distance-variant",
native_unit_of_measurement=UnitOfLength.METERS,
value_fn=lambda _, service_info: service_info.advertisement
and service_info.advertisement.tx_power
@ -79,7 +78,6 @@ SENSOR_DESCRIPTIONS = (
PrivateDeviceSensorEntityDescription(
key="estimated_broadcast_interval",
translation_key="estimated_broadcast_interval",
icon="mdi:timer-sync-outline",
native_unit_of_measurement=UnitOfTime.SECONDS,
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,