Add entity name translations to Tractive (#90738)
Add entity name translations
This commit is contained in:
parent
449f18c9c1
commit
a854a5620f
5 changed files with 39 additions and 9 deletions
|
@ -76,7 +76,7 @@ class TractiveBinarySensor(TractiveEntity, BinarySensorEntity):
|
|||
|
||||
SENSOR_TYPE = BinarySensorEntityDescription(
|
||||
key=ATTR_BATTERY_CHARGING,
|
||||
name="Tracker battery charging",
|
||||
translation_key="tracker_battery_charging",
|
||||
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
)
|
||||
|
|
|
@ -38,7 +38,7 @@ class TractiveDeviceTracker(TractiveEntity, TrackerEntity):
|
|||
|
||||
_attr_has_entity_name = True
|
||||
_attr_icon = "mdi:paw"
|
||||
_attr_name = "Tracker"
|
||||
_attr_translation_key = "tracker"
|
||||
|
||||
def __init__(self, user_id: str, item: Trackables) -> None:
|
||||
"""Initialize tracker entity."""
|
||||
|
|
|
@ -138,7 +138,7 @@ class TractiveActivitySensor(TractiveSensor):
|
|||
SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
||||
TractiveSensorEntityDescription(
|
||||
key=ATTR_BATTERY_LEVEL,
|
||||
name="Tracker battery level",
|
||||
translation_key="tracker_battery_level",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
entity_class=TractiveHardwareSensor,
|
||||
|
@ -148,20 +148,19 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
|||
# Currently, only state operational and not_reporting are used
|
||||
# More states are available by polling the data
|
||||
key=ATTR_TRACKER_STATE,
|
||||
name="Tracker state",
|
||||
translation_key="tracker_state",
|
||||
entity_class=TractiveHardwareSensor,
|
||||
),
|
||||
TractiveSensorEntityDescription(
|
||||
key=ATTR_MINUTES_ACTIVE,
|
||||
name="Minutes active",
|
||||
translation_key="minutes_active",
|
||||
icon="mdi:clock-time-eight-outline",
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
entity_class=TractiveActivitySensor,
|
||||
),
|
||||
TractiveSensorEntityDescription(
|
||||
key=ATTR_DAILY_GOAL,
|
||||
name="Daily goal",
|
||||
translation_key="daily_goal",
|
||||
icon="mdi:flag-checkered",
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
entity_class=TractiveActivitySensor,
|
||||
|
|
|
@ -19,8 +19,28 @@
|
|||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"tracker_battery_charging": {
|
||||
"name": "Tracker battery charging"
|
||||
}
|
||||
},
|
||||
"device_tracker": {
|
||||
"tracker": {
|
||||
"name": "Tracker"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"daily_goal": {
|
||||
"name": "Daily goal"
|
||||
},
|
||||
"minutes_active": {
|
||||
"name": "Minutes active"
|
||||
},
|
||||
"tracker_battery_level": {
|
||||
"name": "Tracker battery"
|
||||
},
|
||||
"tracker_state": {
|
||||
"name": "Tracker state",
|
||||
"state": {
|
||||
"not_reporting": "Not reporting",
|
||||
"operational": "Operational",
|
||||
|
@ -28,6 +48,17 @@
|
|||
"system_startup": "System startup"
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"tracker_buzzer": {
|
||||
"name": "Tracker buzzer"
|
||||
},
|
||||
"tracker_led": {
|
||||
"name": "Tracker LED"
|
||||
},
|
||||
"live_tracking": {
|
||||
"name": "Live tracking"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,21 +47,21 @@ class TractiveSwitchEntityDescription(
|
|||
SWITCH_TYPES: tuple[TractiveSwitchEntityDescription, ...] = (
|
||||
TractiveSwitchEntityDescription(
|
||||
key=ATTR_BUZZER,
|
||||
name="Tracker buzzer",
|
||||
translation_key="tracker_buzzer",
|
||||
icon="mdi:volume-high",
|
||||
method="async_set_buzzer",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
TractiveSwitchEntityDescription(
|
||||
key=ATTR_LED,
|
||||
name="Tracker LED",
|
||||
translation_key="tracker_led",
|
||||
icon="mdi:led-on",
|
||||
method="async_set_led",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
TractiveSwitchEntityDescription(
|
||||
key=ATTR_LIVE_TRACKING,
|
||||
name="Live tracking",
|
||||
translation_key="live_tracking",
|
||||
icon="mdi:map-marker-path",
|
||||
method="async_set_live_tracking",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
|
|
Loading…
Add table
Reference in a new issue