Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: charging_complete_time #35

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions custom_components/audiconnect/audi_connect_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,17 +1640,15 @@ def state_of_charge_supported(self):
def remaining_charging_time(self):
"""Return remaining charging time"""
if self.remaining_charging_time_supported:
return self._vehicle.state.get("remainingChargingTime")
return self._vehicle.state.get("remainingChargingTime", 0)

@property
def remaining_charging_time_unit(self):
return "min"

@property
def remaining_charging_time_supported(self):
check = self._vehicle.state.get("remainingChargingTime")
if check is not None:
return True
return self.car_type in ["hybrid", "electric"]

@property
def charging_complete_time(self):
Expand Down
7 changes: 0 additions & 7 deletions custom_components/audiconnect/audi_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,6 @@ def _tryAppendStateWithTs(self, json, name, tsoff, loc):
val = self._getFromJson(json, loc)
# _LOGGER.debug("Initial value retrieved for '%s': %s", name, val)

# Special handling for remainingChargingTime
if name == "remainingChargingTime" and val is None:
val = 0
_LOGGER.debug(
"TRY APPEND STATE: 'remainingChargingTime' adjusted to 0 due to None value"
)

if val is not None:
loc[tsoff:] = ["carCapturedTimestamp"]
# _LOGGER.debug("Updated loc for timestamp retrieval: %s", loc)
Expand Down
Loading