Repository navigation
Conversation
Replace the instant brightness switch at sunrise/sunset with a smooth cosine transition over a configurable duration (default: 30 minutes, centered on the event — 15 min before and 15 min after). The cosine curve makes the change barely perceptible at the start and end of the transition, with the fastest change in the middle — matching how f.lux, Home Assistant Adaptive Lighting, and other apps handle it. New config option in [brightness_schedule]: sun_transition_minutes = 30 (0 = instant switch, max 120) Setting to 0 restores the previous instant-switch behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the instant brightness switch at sunrise/sunset with a smooth cosine transition.
Before
Brightness jumped from night→day (or day→night) in a single step at the exact minute of sunrise/sunset. Very noticeable.
After
Brightness ramps gradually over 30 minutes (configurable), centered on sunrise/sunset. Uses a cosine curve so the change is barely noticeable at the start/end and fastest in the middle — matching how f.lux and Home Assistant Adaptive Lighting work.
Example with sunrise at 06:30, night=20%, day=80%:
Configuration
New option in
[brightness_schedule]section ofzeclock.ini:sun_transition_minutes = 30Files changed
zeclock/brightness_scheduler.py— cosine ramp in_compute_sun_brightness()zeclock/backend_config.py— new config field + INI parsingzeclock/clock.py— pass new param to schedulerzeclock/remote/rest_remote.py— pass new param on config reload