mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add entity translations to Subaru (#96186)
This commit is contained in:
parent
9a5fe9f644
commit
77f2eb0ac9
@ -58,13 +58,15 @@ class SubaruLock(LockEntity):
|
||||
Note that the Subaru API currently does not support returning the status of the locks. Lock status is always unknown.
|
||||
"""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_translation_key = "door_locks"
|
||||
|
||||
def __init__(self, vehicle_info, controller):
|
||||
"""Initialize the locks for the vehicle."""
|
||||
self.controller = controller
|
||||
self.vehicle_info = vehicle_info
|
||||
vin = vehicle_info[VEHICLE_VIN]
|
||||
self.car_name = vehicle_info[VEHICLE_NAME]
|
||||
self._attr_name = f"{self.car_name} Door Locks"
|
||||
self._attr_unique_id = f"{vin}_door_locks"
|
||||
self._attr_device_info = get_device_info(vehicle_info)
|
||||
|
||||
|
@ -55,9 +55,9 @@ KM_PER_MI = DistanceConverter.convert(1, UnitOfLength.MILES, UnitOfLength.KILOME
|
||||
SAFETY_SENSORS = [
|
||||
SensorEntityDescription(
|
||||
key=sc.ODOMETER,
|
||||
translation_key="odometer",
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
icon="mdi:road-variant",
|
||||
name="Odometer",
|
||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
@ -67,44 +67,44 @@ SAFETY_SENSORS = [
|
||||
API_GEN_2_SENSORS = [
|
||||
SensorEntityDescription(
|
||||
key=sc.AVG_FUEL_CONSUMPTION,
|
||||
translation_key="average_fuel_consumption",
|
||||
icon="mdi:leaf",
|
||||
name="Avg fuel consumption",
|
||||
native_unit_of_measurement=FUEL_CONSUMPTION_LITERS_PER_HUNDRED_KILOMETERS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.DIST_TO_EMPTY,
|
||||
translation_key="range",
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
icon="mdi:gas-station",
|
||||
name="Range",
|
||||
native_unit_of_measurement=UnitOfLength.KILOMETERS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.TIRE_PRESSURE_FL,
|
||||
translation_key="tire_pressure_front_left",
|
||||
device_class=SensorDeviceClass.PRESSURE,
|
||||
name="Tire pressure FL",
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.TIRE_PRESSURE_FR,
|
||||
translation_key="tire_pressure_front_right",
|
||||
device_class=SensorDeviceClass.PRESSURE,
|
||||
name="Tire pressure FR",
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.TIRE_PRESSURE_RL,
|
||||
translation_key="tire_pressure_rear_left",
|
||||
device_class=SensorDeviceClass.PRESSURE,
|
||||
name="Tire pressure RL",
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.TIRE_PRESSURE_RR,
|
||||
translation_key="tire_pressure_rear_right",
|
||||
device_class=SensorDeviceClass.PRESSURE,
|
||||
name="Tire pressure RR",
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
@ -114,8 +114,8 @@ API_GEN_2_SENSORS = [
|
||||
API_GEN_3_SENSORS = [
|
||||
SensorEntityDescription(
|
||||
key=sc.REMAINING_FUEL_PERCENT,
|
||||
translation_key="fuel_level",
|
||||
icon="mdi:gas-station",
|
||||
name="Fuel level",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
@ -125,23 +125,23 @@ API_GEN_3_SENSORS = [
|
||||
EV_SENSORS = [
|
||||
SensorEntityDescription(
|
||||
key=sc.EV_DISTANCE_TO_EMPTY,
|
||||
translation_key="ev_range",
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
icon="mdi:ev-station",
|
||||
name="EV range",
|
||||
native_unit_of_measurement=UnitOfLength.MILES,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.EV_STATE_OF_CHARGE_PERCENT,
|
||||
translation_key="ev_battery_level",
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
name="EV battery level",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=sc.EV_TIME_TO_FULLY_CHARGED_UTC,
|
||||
translation_key="ev_time_to_full_charge",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
name="EV time to full charge",
|
||||
),
|
||||
]
|
||||
|
||||
|
@ -57,6 +57,48 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"lock": {
|
||||
"door_locks": {
|
||||
"name": "Door locks"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"odometer": {
|
||||
"name": "Odometer"
|
||||
},
|
||||
"average_fuel_consumption": {
|
||||
"name": "Average fuel consumption"
|
||||
},
|
||||
"range": {
|
||||
"name": "Range"
|
||||
},
|
||||
"tire_pressure_front_left": {
|
||||
"name": "Tire pressure front left"
|
||||
},
|
||||
"tire_pressure_front_right": {
|
||||
"name": "Tire pressure front right"
|
||||
},
|
||||
"tire_pressure_rear_left": {
|
||||
"name": "Tire pressure rear left"
|
||||
},
|
||||
"tire_pressure_rear_right": {
|
||||
"name": "Tire pressure rear right"
|
||||
},
|
||||
"fuel_level": {
|
||||
"name": "Fuel level"
|
||||
},
|
||||
"ev_range": {
|
||||
"name": "EV range"
|
||||
},
|
||||
"ev_battery_level": {
|
||||
"name": "EV battery level"
|
||||
},
|
||||
"ev_time_to_full_charge": {
|
||||
"name": "EV time to full charge"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"unlock_specific_door": {
|
||||
"name": "Unlock specific door",
|
||||
|
Loading…
x
Reference in New Issue
Block a user