Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 3, 2023
1 parent da5c647 commit 8f0cef3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions custom_components/adaptive_lighting/color_and_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,24 @@ def noon_and_midnight(

total = abs(sunset - sunrise)
middle = total / 2
total = (
total.total_seconds() / 60 / 60 * (2 / 3)
) # about 12 hours normally.
total = total.total_seconds() / 60 / 60 * (2 / 3) # about 12 hours normally.
_LOGGER.debug(
"Calculate noon/midnight. Total diff: %s, middle: %s", total, middle
"Calculate noon/midnight. Total diff: %s, middle: %s",
total,
middle,
)
if sunset > sunrise:
noon = sunrise + middle
midnight = noon + timedelta(hours=total) * (
1 if noon.hour < total else -1
)
midnight = noon + timedelta(hours=total) * (1 if noon.hour < total else -1)
else:
midnight = sunset + middle
noon = midnight + timedelta(hours=total) * (
1 if midnight.hour < total else -1
)
_LOGGER.debug(
"Calculate noon/midnight. Noon: %s Midnight: %s", noon, midnight
"Calculate noon/midnight. Noon: %s Midnight: %s",
noon,
midnight,
)
return noon, midnight

Expand Down

0 comments on commit 8f0cef3

Please sign in to comment.