Skip to content

Commit

Permalink
Fix value of charge_type sensor (#152)
Browse files Browse the repository at this point in the history
* Fix value of sensor when charge_type is None
* Add translation for charge_type states
  • Loading branch information
WebSpider authored Oct 31, 2024
1 parent ffa0783 commit 7d0df80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom_components/myskoda/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ class ChargeType(ChargingSensor):
@property
def native_value(self) -> str | None: # noqa: D102
if status := self._status():
return str(status.charge_type).lower()
if status.charge_type:
return str(status.charge_type).lower()


class ChargingState(ChargingSensor):
Expand Down
7 changes: 6 additions & 1 deletion custom_components/myskoda/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@
"name": "Mileage"
},
"charge_type": {
"name": "Charge Type"
"name": "Charge Type",
"state": {
"ac": "AC",
"dc": "DC",
"off": "OFF"
}
},
"remaining_charging_time": {
"name": "Remaining Charging Time"
Expand Down

0 comments on commit 7d0df80

Please sign in to comment.