Skip to content

Commit

Permalink
Merge pull request #599 from alandtse/dev
Browse files Browse the repository at this point in the history
chore: release 2023-05-06
  • Loading branch information
alandtse authored May 6, 2023
2 parents dbaa5c7 + 92da756 commit dc279a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
- id: commitizen
stages: ["commit-msg"]
repo: https://github.com/commitizen-tools/commitizen
rev: 3.0.1
rev: 3.2.0
# --- Linters ---
- hooks:
- id: dockerfile_lint
Expand All @@ -61,7 +61,7 @@ repos:
)$
rev: v3.0.0-alpha.9-for-vscode
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.3.2
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand Down
7 changes: 5 additions & 2 deletions custom_components/tesla_custom/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,10 @@ def native_value(self) -> Optional[datetime]:
+ timedelta(hours=charge_hours)
- (dt.utcnow() - self._last_update_time)
)
if self._value is None or (new_value - self._value).total_seconds() >= 60:
if (
self._value is None
or abs((new_value - self._value).total_seconds()) >= 60
):
self._value = new_value
if self._car.charging_state in ["Charging", "Complete"]:
return self._value
Expand Down Expand Up @@ -686,7 +689,7 @@ def native_value(self) -> Optional[datetime]:
)
if (
self._datetime_value is None
or (new_value - self._datetime_value).total_seconds() >= 60
or abs((new_value - self._datetime_value).total_seconds()) >= 60
):
self._datetime_value = new_value
return self._datetime_value
Expand Down

0 comments on commit dc279a8

Please sign in to comment.