Add entity translations to Renault (#83392)

This commit is contained in:
epenet 2022-12-08 23:48:24 +01:00 committed by GitHub
parent 26080fbb89
commit 7f345e7672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 0 deletions

View file

@ -90,6 +90,7 @@ SENSOR_TYPES: tuple[RenaultSelectEntityDescription, ...] = (
key="charge_mode",
coordinator="charge_mode",
data_key="chargeMode",
translation_key="charge_mode",
icon_lambda=_get_charge_mode_icon,
name="Charge mode",
options=["always", "always_charging", "schedule_mode"],

View file

@ -171,9 +171,21 @@ SENSOR_TYPES: tuple[RenaultSensorEntityDescription[Any], ...] = (
key="charge_state",
coordinator="battery",
data_key="chargingStatus",
translation_key="charge_state",
device_class=SensorDeviceClass.ENUM,
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
icon_lambda=_get_charge_state_icon,
name="Charge state",
options=[
"not_in_charge",
"waiting_for_a_planned_charge",
"charge_ended",
"waiting_for_current_charge",
"energy_flap_opened",
"charge_in_progress",
"charge_error",
"unavailable",
],
value_lambda=_get_charge_state_formatted,
),
RenaultSensorEntityDescription(
@ -218,9 +230,12 @@ SENSOR_TYPES: tuple[RenaultSensorEntityDescription[Any], ...] = (
key="plug_state",
coordinator="battery",
data_key="plugStatus",
translation_key="plug_state",
device_class=SensorDeviceClass.ENUM,
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
icon_lambda=_get_plug_state_icon,
name="Plug state",
options=["unplugged", "plugged", "plug_error", "plug_unknown"],
value_lambda=_get_plug_state_formatted,
),
RenaultSensorEntityDescription(

View file

@ -31,5 +31,38 @@
"title": "Set Renault credentials"
}
}
},
"entity": {
"select": {
"charge_mode": {
"state": {
"always": "Instant",
"always_charging": "Instant",
"schedule_mode": "Planner"
}
}
},
"sensor": {
"plug_state": {
"state": {
"unplugged": "Unplugged",
"plugged": "Plugged in",
"plug_error": "Plug error",
"plug_unknown": "Plug unknown"
}
},
"charge_state": {
"state": {
"not_in_charge": "Not charging",
"waiting_for_a_planned_charge": "Waiting for planned charge",
"charge_ended": "Charge ended",
"waiting_for_current_charge": "Waiting for current charge",
"energy_flap_opened": "Energy flap opened",
"charge_in_progress": "Charging",
"charge_error": "Not charging or plugged in",
"unavailable": "Unavailable"
}
}
}
}
}

View file

@ -31,5 +31,38 @@
"title": "Set Renault credentials"
}
}
},
"entity":{
"select": {
"charge_mode": {
"state": {
"always": "Instant",
"always_charging": "Instant",
"schedule_mode": "Planner"
}
}
},
"sensor": {
"plug_state": {
"state": {
"unplugged": "Unplugged",
"plugged": "Plugged in",
"plug_error": "Plug error",
"plug_unknown": "Plug unknown"
}
},
"charge_state": {
"state": {
"not_in_charge": "Not charging",
"waiting_for_a_planned_charge": "Waiting for planned charge",
"charge_ended": "Charge ended",
"waiting_for_current_charge": "Waiting for current charge",
"energy_flap_opened": "Energy flap opened",
"charge_in_progress": "Charging",
"charge_error": "Not charging or plugged in",
"unavailable": "Unavailable"
}
}
}
}
}

View file

@ -167,8 +167,19 @@ MOCK_VEHICLES = {
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_charge_state",
ATTR_ICON: "mdi:flash",
ATTR_OPTIONS: [
"not_in_charge",
"waiting_for_a_planned_charge",
"charge_ended",
"waiting_for_current_charge",
"energy_flap_opened",
"charge_in_progress",
"charge_error",
"unavailable",
],
ATTR_STATE: "charge_in_progress",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_charge_state",
},
@ -219,8 +230,10 @@ MOCK_VEHICLES = {
ATTR_UNIQUE_ID: "vf1aaaaa555777999_hvac_last_activity",
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_STATE: "plugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
},
@ -383,8 +396,19 @@ MOCK_VEHICLES = {
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_charge_state",
ATTR_ICON: "mdi:flash-off",
ATTR_OPTIONS: [
"not_in_charge",
"waiting_for_a_planned_charge",
"charge_ended",
"waiting_for_current_charge",
"energy_flap_opened",
"charge_in_progress",
"charge_error",
"unavailable",
],
ATTR_STATE: "charge_error",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_charge_state",
},
@ -435,8 +459,10 @@ MOCK_VEHICLES = {
ATTR_UNIQUE_ID: "vf1aaaaa555777999_hvac_last_activity",
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug-off",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_STATE: "unplugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
},
@ -599,8 +625,19 @@ MOCK_VEHICLES = {
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_charge_state",
ATTR_ICON: "mdi:flash",
ATTR_OPTIONS: [
"not_in_charge",
"waiting_for_a_planned_charge",
"charge_ended",
"waiting_for_current_charge",
"energy_flap_opened",
"charge_in_progress",
"charge_error",
"unavailable",
],
ATTR_STATE: "charge_in_progress",
ATTR_UNIQUE_ID: "vf1aaaaa555777123_charge_state",
},
@ -648,8 +685,10 @@ MOCK_VEHICLES = {
ATTR_UNIT_OF_MEASUREMENT: LENGTH_KILOMETERS,
},
{
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_STATE: "plugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777123_plug_state",
},