Add icon translations to Tractive (#110138)

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
This commit is contained in:
Maciej Bieniek 2024-02-09 23:28:56 +01:00 committed by GitHub
parent 57bec29266
commit c2818dcb8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 58 additions and 13 deletions

View File

@ -36,7 +36,6 @@ async def async_setup_entry(
class TractiveDeviceTracker(TractiveEntity, TrackerEntity): class TractiveDeviceTracker(TractiveEntity, TrackerEntity):
"""Tractive device tracker.""" """Tractive device tracker."""
_attr_icon = "mdi:paw"
_attr_translation_key = "tracker" _attr_translation_key = "tracker"
def __init__(self, client: TractiveClient, item: Trackables) -> None: def __init__(self, client: TractiveClient, item: Trackables) -> None:

View File

@ -0,0 +1,58 @@
{
"entity": {
"device_tracker": {
"tracker": {
"default": "mdi:paw"
}
},
"sensor": {
"activity": {
"default": "mdi:run"
},
"activity_time": {
"default": "mdi:clock-time-eight-outline"
},
"calories": {
"default": "mdi:fire"
},
"daily_goal": {
"default": "mdi:flag-checkered"
},
"minutes_day_sleep": {
"default": "mdi:sleep"
},
"minutes_night_sleep": {
"default": "mdi:sleep"
},
"rest_time": {
"default": "mdi:clock-time-eight-outline"
},
"sleep": {
"default": "mdi:sleep"
},
"tracker_state": {
"default": "mdi:radar"
}
},
"switch": {
"tracker_buzzer": {
"default": "mdi:volume-high",
"state": {
"off": "mdi:volume-off"
}
},
"tracker_led": {
"default": "mdi:led-on",
"state": {
"off": "mdi:led-off"
}
},
"live_tracking": {
"default": "mdi:map-marker-path",
"state": {
"off": "mdi:map-marker-off"
}
}
}
}
}

View File

@ -111,7 +111,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
translation_key="tracker_state", translation_key="tracker_state",
signal_prefix=TRACKER_HARDWARE_STATUS_UPDATED, signal_prefix=TRACKER_HARDWARE_STATUS_UPDATED,
hardware_sensor=True, hardware_sensor=True,
icon="mdi:radar",
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.ENUM, device_class=SensorDeviceClass.ENUM,
options=[ options=[
@ -124,7 +123,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_MINUTES_ACTIVE, key=ATTR_MINUTES_ACTIVE,
translation_key="activity_time", translation_key="activity_time",
icon="mdi:clock-time-eight-outline",
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
signal_prefix=TRACKER_ACTIVITY_STATUS_UPDATED, signal_prefix=TRACKER_ACTIVITY_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
@ -132,7 +130,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_MINUTES_REST, key=ATTR_MINUTES_REST,
translation_key="rest_time", translation_key="rest_time",
icon="mdi:clock-time-eight-outline",
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
@ -140,7 +137,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_CALORIES, key=ATTR_CALORIES,
translation_key="calories", translation_key="calories",
icon="mdi:fire",
native_unit_of_measurement="kcal", native_unit_of_measurement="kcal",
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
@ -148,14 +144,12 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_DAILY_GOAL, key=ATTR_DAILY_GOAL,
translation_key="daily_goal", translation_key="daily_goal",
icon="mdi:flag-checkered",
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
signal_prefix=TRACKER_ACTIVITY_STATUS_UPDATED, signal_prefix=TRACKER_ACTIVITY_STATUS_UPDATED,
), ),
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_MINUTES_DAY_SLEEP, key=ATTR_MINUTES_DAY_SLEEP,
translation_key="minutes_day_sleep", translation_key="minutes_day_sleep",
icon="mdi:sleep",
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
@ -163,7 +157,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_MINUTES_NIGHT_SLEEP, key=ATTR_MINUTES_NIGHT_SLEEP,
translation_key="minutes_night_sleep", translation_key="minutes_night_sleep",
icon="mdi:sleep",
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
@ -171,7 +164,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_SLEEP_LABEL, key=ATTR_SLEEP_LABEL,
translation_key="sleep", translation_key="sleep",
icon="mdi:sleep",
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
value_fn=lambda state: state.lower() if isinstance(state, str) else state, value_fn=lambda state: state.lower() if isinstance(state, str) else state,
device_class=SensorDeviceClass.ENUM, device_class=SensorDeviceClass.ENUM,
@ -184,7 +176,6 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
TractiveSensorEntityDescription( TractiveSensorEntityDescription(
key=ATTR_ACTIVITY_LABEL, key=ATTR_ACTIVITY_LABEL,
translation_key="activity", translation_key="activity",
icon="mdi:run",
signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED, signal_prefix=TRACKER_WELLNESS_STATUS_UPDATED,
value_fn=lambda state: state.lower() if isinstance(state, str) else state, value_fn=lambda state: state.lower() if isinstance(state, str) else state,
device_class=SensorDeviceClass.ENUM, device_class=SensorDeviceClass.ENUM,

View File

@ -46,21 +46,18 @@ SWITCH_TYPES: tuple[TractiveSwitchEntityDescription, ...] = (
TractiveSwitchEntityDescription( TractiveSwitchEntityDescription(
key=ATTR_BUZZER, key=ATTR_BUZZER,
translation_key="tracker_buzzer", translation_key="tracker_buzzer",
icon="mdi:volume-high",
method="async_set_buzzer", method="async_set_buzzer",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
TractiveSwitchEntityDescription( TractiveSwitchEntityDescription(
key=ATTR_LED, key=ATTR_LED,
translation_key="tracker_led", translation_key="tracker_led",
icon="mdi:led-on",
method="async_set_led", method="async_set_led",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
TractiveSwitchEntityDescription( TractiveSwitchEntityDescription(
key=ATTR_LIVE_TRACKING, key=ATTR_LIVE_TRACKING,
translation_key="live_tracking", translation_key="live_tracking",
icon="mdi:map-marker-path",
method="async_set_live_tracking", method="async_set_live_tracking",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),