Skip to content

Commit

Permalink
Merge branch 'charging_options_reformat' into extend-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
WebSpider committed Sep 30, 2024
2 parents 4cc4812 + 32fe07a commit 6090d1b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 9 additions & 5 deletions custom_components/myskoda/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
9 changes: 9 additions & 0 deletions custom_components/myskoda/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@
"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"
},
Expand Down

0 comments on commit 6090d1b

Please sign in to comment.