mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add entity name translations to Tractive (#90738)
Add entity name translations
This commit is contained in:
parent
449f18c9c1
commit
a854a5620f
@ -76,7 +76,7 @@ class TractiveBinarySensor(TractiveEntity, BinarySensorEntity):
|
|||||||
|
|
||||||
SENSOR_TYPE = BinarySensorEntityDescription(
|
SENSOR_TYPE = BinarySensorEntityDescription(
|
||||||
key=ATTR_BATTERY_CHARGING,
|
key=ATTR_BATTERY_CHARGING,
|
||||||
name="Tracker battery charging",
|
translation_key="tracker_battery_charging",
|
||||||
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
|
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@ class TractiveDeviceTracker(TractiveEntity, TrackerEntity):
|
|||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
_attr_icon = "mdi:paw"
|
_attr_icon = "mdi:paw"
|
||||||
_attr_name = "Tracker"
|
_attr_translation_key = "tracker"
|
||||||
|
|
||||||
def __init__(self, user_id: str, item: Trackables) -> None:
|
def __init__(self, user_id: str, item: Trackables) -> None:
|
||||||
"""Initialize tracker entity."""
|
"""Initialize tracker entity."""
|
||||||
|
@ -138,7 +138,7 @@ class TractiveActivitySensor(TractiveSensor):
|
|||||||
SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
||||||
TractiveSensorEntityDescription(
|
TractiveSensorEntityDescription(
|
||||||
key=ATTR_BATTERY_LEVEL,
|
key=ATTR_BATTERY_LEVEL,
|
||||||
name="Tracker battery level",
|
translation_key="tracker_battery_level",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=SensorDeviceClass.BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_class=TractiveHardwareSensor,
|
entity_class=TractiveHardwareSensor,
|
||||||
@ -148,20 +148,19 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
|||||||
# Currently, only state operational and not_reporting are used
|
# Currently, only state operational and not_reporting are used
|
||||||
# More states are available by polling the data
|
# More states are available by polling the data
|
||||||
key=ATTR_TRACKER_STATE,
|
key=ATTR_TRACKER_STATE,
|
||||||
name="Tracker state",
|
|
||||||
translation_key="tracker_state",
|
translation_key="tracker_state",
|
||||||
entity_class=TractiveHardwareSensor,
|
entity_class=TractiveHardwareSensor,
|
||||||
),
|
),
|
||||||
TractiveSensorEntityDescription(
|
TractiveSensorEntityDescription(
|
||||||
key=ATTR_MINUTES_ACTIVE,
|
key=ATTR_MINUTES_ACTIVE,
|
||||||
name="Minutes active",
|
translation_key="minutes_active",
|
||||||
icon="mdi:clock-time-eight-outline",
|
icon="mdi:clock-time-eight-outline",
|
||||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
entity_class=TractiveActivitySensor,
|
entity_class=TractiveActivitySensor,
|
||||||
),
|
),
|
||||||
TractiveSensorEntityDescription(
|
TractiveSensorEntityDescription(
|
||||||
key=ATTR_DAILY_GOAL,
|
key=ATTR_DAILY_GOAL,
|
||||||
name="Daily goal",
|
translation_key="daily_goal",
|
||||||
icon="mdi:flag-checkered",
|
icon="mdi:flag-checkered",
|
||||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
entity_class=TractiveActivitySensor,
|
entity_class=TractiveActivitySensor,
|
||||||
|
@ -19,8 +19,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
|
"binary_sensor": {
|
||||||
|
"tracker_battery_charging": {
|
||||||
|
"name": "Tracker battery charging"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"device_tracker": {
|
||||||
|
"tracker": {
|
||||||
|
"name": "Tracker"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
"daily_goal": {
|
||||||
|
"name": "Daily goal"
|
||||||
|
},
|
||||||
|
"minutes_active": {
|
||||||
|
"name": "Minutes active"
|
||||||
|
},
|
||||||
|
"tracker_battery_level": {
|
||||||
|
"name": "Tracker battery"
|
||||||
|
},
|
||||||
"tracker_state": {
|
"tracker_state": {
|
||||||
|
"name": "Tracker state",
|
||||||
"state": {
|
"state": {
|
||||||
"not_reporting": "Not reporting",
|
"not_reporting": "Not reporting",
|
||||||
"operational": "Operational",
|
"operational": "Operational",
|
||||||
@ -28,6 +48,17 @@
|
|||||||
"system_startup": "System startup"
|
"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, ...] = (
|
SWITCH_TYPES: tuple[TractiveSwitchEntityDescription, ...] = (
|
||||||
TractiveSwitchEntityDescription(
|
TractiveSwitchEntityDescription(
|
||||||
key=ATTR_BUZZER,
|
key=ATTR_BUZZER,
|
||||||
name="Tracker buzzer",
|
translation_key="tracker_buzzer",
|
||||||
icon="mdi:volume-high",
|
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,
|
||||||
name="Tracker LED",
|
translation_key="tracker_led",
|
||||||
icon="mdi:led-on",
|
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,
|
||||||
name="Live tracking",
|
translation_key="live_tracking",
|
||||||
icon="mdi:map-marker-path",
|
icon="mdi:map-marker-path",
|
||||||
method="async_set_live_tracking",
|
method="async_set_live_tracking",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user