Skip to content

Commit

Permalink
Small translation updates (#154)
Browse files Browse the repository at this point in the history
* Remove name from entities since this disables translation of entity names
* Add translatable states for binary sensors
  • Loading branch information
WebSpider authored Oct 31, 2024
1 parent 7d0df80 commit 2d7cca5
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 34 deletions.
10 changes: 0 additions & 10 deletions custom_components/myskoda/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class ChargerConnected(AirConditioningBinarySensor):

entity_description = BinarySensorEntityDescription(
key="charger_connected",
name="Charger Connected",
device_class=BinarySensorDeviceClass.PLUG,
translation_key="charger_connected",
)
Expand All @@ -92,7 +91,6 @@ class ChargerLocked(AirConditioningBinarySensor):

entity_description = BinarySensorEntityDescription(
key="charger_locked",
name="Charger",
device_class=BinarySensorDeviceClass.LOCK,
translation_key="charger_locked",
)
Expand All @@ -111,7 +109,6 @@ class Locked(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="locked",
name="Locks",
device_class=BinarySensorDeviceClass.LOCK,
translation_key="locked",
)
Expand All @@ -127,7 +124,6 @@ class DoorsLocked(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="doors_locked",
name="Doors Locked",
device_class=BinarySensorDeviceClass.LOCK,
translation_key="doors_locked",
)
Expand All @@ -143,7 +139,6 @@ class DoorsOpen(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="doors_open",
name="Doors",
device_class=BinarySensorDeviceClass.DOOR,
translation_key="doors_open",
)
Expand All @@ -159,7 +154,6 @@ class WindowsOpen(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="windows_open",
name="Windows",
device_class=BinarySensorDeviceClass.WINDOW,
translation_key="windows_open",
)
Expand All @@ -175,7 +169,6 @@ class TrunkOpen(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="trunk_open",
name="Trunk",
device_class=BinarySensorDeviceClass.OPENING,
translation_key="trunk_open",
)
Expand All @@ -191,7 +184,6 @@ class BonnetOpen(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="bonnet_open",
name="Bonnet",
device_class=BinarySensorDeviceClass.OPENING,
translation_key="bonnet_open",
)
Expand All @@ -207,7 +199,6 @@ class SunroofOpen(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="sunroof_open",
name="Sunroof",
device_class=BinarySensorDeviceClass.OPENING,
)

Expand Down Expand Up @@ -235,7 +226,6 @@ class LightsOn(StatusBinarySensor):

entity_description = BinarySensorEntityDescription(
key="lights_on",
name="Lights",
device_class=BinarySensorDeviceClass.LIGHT,
translation_key="lights_on",
)
Expand Down
1 change: 0 additions & 1 deletion custom_components/myskoda/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MySkodaClimate(MySkodaEntity, ClimateEntity):

entity_description = ClimateEntityDescription(
key="climate",
name="Air Conditioning",
translation_key="climate",
)
_attr_temperature_unit = UnitOfTemperature.CELSIUS
Expand Down
1 change: 0 additions & 1 deletion custom_components/myskoda/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class MainRenderImage(MySkodaImage):

entity_description = ImageEntityDescription(
key="render_vehicle_main",
name="Main Vehicle Render",
translation_key="render_vehicle_main",
entity_category=EntityCategory.DIAGNOSTIC,
)
Expand Down
1 change: 0 additions & 1 deletion custom_components/myskoda/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class ChargeLimit(MySkodaNumber):

entity_description = NumberEntityDescription(
key="charge_limit",
name="Charge Limit",
native_max_value=100,
native_min_value=50,
native_unit_of_measurement=PERCENTAGE,
Expand Down
11 changes: 0 additions & 11 deletions custom_components/myskoda/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class SoftwareVersion(MySkodaSensor):

entity_description = SensorEntityDescription(
key="software_version",
name="Software Version",
translation_key="software_version",
)

Expand Down Expand Up @@ -90,7 +89,6 @@ class BatteryPercentage(ChargingSensor):

entity_description = SensorEntityDescription(
key="battery_percentage",
name="Battery Percentage",
icon="mdi:battery",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
Expand Down Expand Up @@ -147,7 +145,6 @@ class ChargingPower(ChargingSensor):

entity_description = SensorEntityDescription(
key="charging_power",
name="Charging Power",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPower.KILO_WATT,
device_class=SensorDeviceClass.POWER,
Expand All @@ -165,7 +162,6 @@ class RemainingDistance(ChargingSensor):

entity_description = SensorEntityDescription(
key="range",
name="Range",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfLength.KILOMETERS,
device_class=SensorDeviceClass.DISTANCE,
Expand All @@ -183,7 +179,6 @@ class TargetBatteryPercentage(ChargingSensor):

entity_description = SensorEntityDescription(
key="target_battery_percentage",
name="Target Battery Percentage",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
Expand All @@ -201,7 +196,6 @@ class Mileage(MySkodaSensor):

entity_description = SensorEntityDescription(
key="milage",
name="Milage",
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfLength.KILOMETERS,
device_class=SensorDeviceClass.DISTANCE,
Expand All @@ -222,7 +216,6 @@ class InspectionInterval(MySkodaSensor):

entity_description = SensorEntityDescription(
key="inspection",
name="Inspection",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.DAYS,
Expand All @@ -243,7 +236,6 @@ class ChargeType(ChargingSensor):

entity_description = SensorEntityDescription(
key="charge_type",
name="Charge Type",
translation_key="charge_type",
)

Expand All @@ -259,7 +251,6 @@ class ChargingState(ChargingSensor):

entity_description = SensorEntityDescription(
key="charging_state",
name="Charging State",
device_class=SensorDeviceClass.ENUM,
translation_key="charging_state",
)
Expand All @@ -284,7 +275,6 @@ class RemainingChargingTime(ChargingSensor):

entity_description = SensorEntityDescription(
key="remaining_charging_time",
name="Remaining Charging Time",
device_class=SensorDeviceClass.DURATION,
native_unit_of_measurement=UnitOfTime.MINUTES,
translation_key="remaining_charging_time",
Expand All @@ -301,7 +291,6 @@ class LastUpdated(MySkodaSensor):

entity_description = SensorEntityDescription(
key="car_captured",
name="Last Updated",
device_class=SensorDeviceClass.TIMESTAMP,
translation_key="car_captured",
)
Expand Down
60 changes: 50 additions & 10 deletions custom_components/myskoda/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,74 @@
"entity": {
"binary_sensor": {
"charger_connected": {
"name": "Charger Connected"
"name": "Charger Connected",
"state": {
"on": "Plugged in",
"off": "Unplugged"
}
},
"charger_locked": {
"name": "Charge Lock"
"name": "Charge Lock",
"state": {
"on": "Unlocked",
"off": "Locked"
}
},
"locked": {
"name": "Vehicle Locked"
"name": "Vehicle Locked",
"state": {
"on": "Unlocked",
"off": "Locked"
}
},
"doors_locked": {
"name": "Doors Locked"
"name": "Doors Locked",
"state": {
"on": "Unlocked",
"off": "Locked"
}
},
"doors_open": {
"name": "Doors Open"
"name": "Doors Open",
"state": {
"on": "Open",
"off": "Closed"
}
},
"windows_open": {
"name": "Windows"
"name": "Windows",
"state": {
"on": "Open",
"off": "Closed"
}
},
"trunk_open": {
"name": "Trunk"
"name": "Trunk",
"state": {
"on": "Open",
"off": "Closed"
}
},
"bonnet_open": {
"name": "Bonnet"
"name": "Bonnet",
"state": {
"on": "Open",
"off": "Closed"
}
},
"sunroof_open": {
"name": "Sunroof"
"name": "Sunroof",
"state": {
"on": "Open",
"off": "Closed"
}
},
"lights_on": {
"name": "Lights"
"name": "Lights",
"state": {
"on": "On",
"off": "Off"
}
}
},
"climate": {
Expand Down

0 comments on commit 2d7cca5

Please sign in to comment.