Skip to content

Commit

Permalink
Merge pull request #380 from alandtse/dev
Browse files Browse the repository at this point in the history
fix: use utc time zone for charge complete sensor
  • Loading branch information
alandtse authored Nov 29, 2022
2 parents 62d2b1f + f13c618 commit ecb0160
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/tesla_custom/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def native_value(self) -> Optional[datetime]:
else:
charge_hours = float(self._car.time_to_full_charge)
if self._car.charging_state == "Charging" and charge_hours > 0:
new_value = dt.now() + timedelta(hours=charge_hours)
new_value = dt.utcnow() + timedelta(hours=charge_hours)
if self._value is None or (new_value - self._value).total_seconds() >= 60:
self._value = new_value
if self._car.charging_state in ["Charging", "Complete"]:
Expand Down

0 comments on commit ecb0160

Please sign in to comment.