diff --git a/custom_components/myskoda/sensor.py b/custom_components/myskoda/sensor.py index a782f1d..941dd72 100644 --- a/custom_components/myskoda/sensor.py +++ b/custom_components/myskoda/sensor.py @@ -253,21 +253,25 @@ class ChargingState(ChargingSensor): device_class=SensorDeviceClass.ENUM, translation_key="charging_state", ) + + # lower_snake_case for translations _attr_options = [ - "CONNECT_CABLE", - "READY_FOR_CHARGING", - "CONSERVING", - "CHARGING", + "connect_cable", + "ready_for_charging", + "conserving", + "charging", ] @property def native_value(self): # noqa: D102 - return self._status().state + return str(self._status().state).lower() @property def icon(self): # noqa: D102 if self._status().state == charging.ChargingState.CONNECT_CABLE: return "mdi:power-plug-off" + if self._status().state == charging.ChargingState.CHARGING: + return "mdi:power-plug-battery" return "mdi:power-plug" diff --git a/custom_components/myskoda/switch.py b/custom_components/myskoda/switch.py index 827f0dc..b878009 100644 --- a/custom_components/myskoda/switch.py +++ b/custom_components/myskoda/switch.py @@ -62,6 +62,7 @@ class WindowHeating(MySkodaSwitch): name="Window Heating", icon="mdi:car-defrost-front", device_class=SwitchDeviceClass.SWITCH, + translation_key="window_heating", ) def _air_conditioning(self) -> AirConditioning: @@ -92,6 +93,16 @@ def required_capabilities(self) -> list[CapabilityId]: class ChargingSwitch(MySkodaSwitch): + """Shows charging.""" + + entity_description = SwitchEntityDescription( + key="charging_switch", + name="Charging", + icon="mdi:car-electric", + device_class=SwitchDeviceClass.SWITCH, + translation_key="charging_switch", + ) + def _charging(self) -> Charging: charging = self.vehicle.charging if charging is None: @@ -129,6 +140,7 @@ class BatteryCareMode(ChargingSwitch): name="Battery Care Mode", icon="mdi:battery-heart-variant", device_class=SwitchDeviceClass.SWITCH, + translation_key="battery_care_mode", ) @property @@ -156,6 +168,7 @@ class ReducedCurrent(ChargingSwitch): name="Reduced Current", icon="mdi:current-ac", device_class=SwitchDeviceClass.SWITCH, + translation_key="reduced_current", ) @property @@ -183,6 +196,7 @@ class EnableCharging(ChargingSwitch): name="Charging", icon="mdi:power-plug-battery", device_class=SwitchDeviceClass.SWITCH, + translation_key="charging", ) @property diff --git a/custom_components/myskoda/translations/en.json b/custom_components/myskoda/translations/en.json index 480a323..9a371d4 100644 --- a/custom_components/myskoda/translations/en.json +++ b/custom_components/myskoda/translations/en.json @@ -17,6 +17,110 @@ } } }, + "entity": { + "binary_sensor": { + "charger_connected": { + "name": "Charger Connected" + }, + "charger_locked": { + "name": "Charge Lock" + }, + "locked": { + "name": "Vehicle Locked" + }, + "doors_locked": { + "name": "Doors Locked" + }, + "doors_open": { + "name": "Doors Open" + }, + "windows_open": { + "name": "Windows" + }, + "trunk_open": { + "name": "Trunk" + }, + "bonnet_open": { + "name": "Bonnet" + }, + "sunroof_open": { + "name": "Sunroof" + }, + "lights_on": { + "name": "Lights" + } + }, + "climate": { + "climate": { + "name": "Air Conditioning" + } + }, + "device_tracker": { + "device_tracker": { + "name": "Positition" + } + }, + "number": { + "charge_limit": { + "name": "Charge Limit" + } + }, + "sensor": { + "software_version": { + "name": "Software Version" + }, + "battery_percentage": { + "name": "Battery Percentage" + }, + "charging_power": { + "name": "Charging Power" + }, + "charging_state": { + "name": "Charging State", + "state": { + "connect_cable": "Cable Disconnected", + "ready_for_charging": "Ready for Charging", + "conserving": "Conserving Charge", + "charging": "Charging" + } + }, + "range": { + "name": "Range" + }, + "target_battery_percentage": { + "name": "Target Battery Percentage" + }, + "mileage": { + "name": "Mileage" + }, + "charge_type": { + "name": "Charge Type" + }, + "remaining_charging_time": { + "name": "Remaining Charging Time" + }, + "car_captured": { + "name": "Last Updated" + } + }, + "switch": { + "window_heating": { + "name": "Window Heating" + }, + "charging_switch": { + "name": "Charging" + }, + "battery_care_mode": { + "name": "Battery Care" + }, + "reduced_current": { + "name": "Reduced Current" + }, + "charging": { + "name": "Charging" + } + } + }, "options": { "step": { "init": {