Skip to content

Commit

Permalink
sound times for charging time reached to avoid it looking very precis…
Browse files Browse the repository at this point in the history
…e while it is approximitly 5min precise
  • Loading branch information
tillsteinbach committed Jan 9, 2025
1 parent 6ce1bbf commit 540af58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/carconnectivity_connectors/skoda/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def fetch_charging(self, vehicle: SkodaElectricVehicle, no_cache: bool = False)
if 'remainingTimeToFullyChargedInMinutes' in data['status'] and data['status']['remainingTimeToFullyChargedInMinutes'] is not None:
remaining_duration: timedelta = timedelta(minutes=data['status']['remainingTimeToFullyChargedInMinutes'])
estimated_date_reached: datetime = captured_at + remaining_duration
estimated_date_reached = estimated_date_reached.replace(second=0, microsecond=0)
# pylint: disable-next=protected-access
vehicle.charging.estimated_date_reached._set_value(value=estimated_date_reached, measured=captured_at)
else:
Expand Down
1 change: 1 addition & 0 deletions src/carconnectivity_connectors/skoda/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def _on_message_callback(self, mqttc, obj, msg) -> None: # noqa: C901
try:
remaining_duration: Optional[timedelta] = timedelta(minutes=int(data['data']['timeToFinish']))
estimated_date_reached: Optional[datetime] = measured_at + remaining_duration
estimated_date_reached = estimated_date_reached.replace(second=0, microsecond=0)
except ValueError:
estimated_date_reached: Optional[datetime] = None
# pylint: disable-next=protected-access
Expand Down

0 comments on commit 540af58

Please sign in to comment.