Skip to content

Commit

Permalink
Merge branch 'main' into weblate-adaptive-lighting-adaptive-lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt authored Oct 10, 2023
2 parents 53ddbde + 2f19dc2 commit 284d1fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.284
rev: v0.0.292
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
4 changes: 2 additions & 2 deletions custom_components/adaptive_lighting/color_and_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ def sun_position(self, dt: datetime.datetime) -> float:
def closest_event(self, dt: datetime.datetime) -> tuple[str, float]:
"""Get the closest sunset or sunrise event."""
(prev_event, prev_ts), (next_event, next_ts) = self.prev_and_next_events(dt)
if prev_event == SUN_EVENT_SUNRISE or next_event == SUN_EVENT_SUNRISE:
if SUN_EVENT_SUNRISE in (prev_event, next_event):
ts_event = prev_ts if prev_event == SUN_EVENT_SUNRISE else next_ts
return SUN_EVENT_SUNRISE, ts_event
if prev_event == SUN_EVENT_SUNSET or next_event == SUN_EVENT_SUNSET:
if SUN_EVENT_SUNSET in (prev_event, next_event):
ts_event = prev_ts if prev_event == SUN_EVENT_SUNSET else next_ts
return SUN_EVENT_SUNSET, ts_event
msg = "No sunrise or sunset event found."
Expand Down

0 comments on commit 284d1fe

Please sign in to comment.