Skip to content

Commit

Permalink
fix: parse new SoC keys in websocket output (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Aug 10, 2024
1 parent 509f947 commit 5ec11f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openevsehttp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,20 +1235,26 @@ def vehicle_soc(self) -> int | None:
"""Return battery level."""
if self._status is not None and "vehicle_soc" in self._status:
return self._status["vehicle_soc"]
if self._status is not None and "battery_level" in self._status:
return self._status["battery_level"]
return None

@property
def vehicle_range(self) -> int | None:
"""Return battery range."""
if self._status is not None and "vehicle_range" in self._status:
return self._status["vehicle_range"]
if self._status is not None and "battery_range" in self._status:
return self._status["battery_range"]
return None

@property
def vehicle_eta(self) -> int | None:
"""Return time to full charge."""
if self._status is not None and "vehicle_eta" in self._status:
return self._status["vehicle_eta"]
if self._status is not None and "time_to_full_charge" in self._status:
return self._status["time_to_full_charge"]
return None

# There is currently no min/max amps JSON data
Expand Down

0 comments on commit 5ec11f4

Please sign in to comment.