Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adapt_brightness_until_sleep and adapt_color_temp_until_sleep #566

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

th3w1zard1
Copy link
Collaborator

@th3w1zard1 th3w1zard1 commented Apr 10, 2023

Added two more config options to support @igiannakas 's PR as that one only modified color temp.
transition_color_temp_until_sleep will default to True while the other defaults to False to support backward compatibility

@th3w1zard1 th3w1zard1 requested a review from basnijholt as a code owner April 10, 2023 09:12
@th3w1zard1 th3w1zard1 changed the title add transition_brightness_until_sleep as the original option only modified ct add transition_brightness_until_sleep and transition_color_temp_until_sleep Apr 10, 2023
@th3w1zard1
Copy link
Collaborator Author

@basnijholt Your code to autofill all the docs is absolutely beautiful.

@th3w1zard1 th3w1zard1 changed the title add transition_brightness_until_sleep and transition_color_temp_until_sleep add adapt_brightness_until_sleep and adapt_color_temp_until_sleep Apr 10, 2023
th3w1zard1 added a commit that referenced this pull request Apr 10, 2023
@th3w1zard1 th3w1zard1 changed the title add adapt_brightness_until_sleep and adapt_color_temp_until_sleep Add adapt_brightness_until_sleep and adapt_color_temp_until_sleep Apr 10, 2023
@@ -26,7 +26,9 @@
"initial_transition": "initial_transition: Duration of the first transition when lights turn from `off` to `on` in seconds. ⏲️",
"sleep_transition": "sleep_transition: Duration of transition when \"sleep mode\" is toggled in seconds. 😴",
"transition": "transition: Duration of transition when lights change, in seconds. 🕑",
"transition_until_sleep": "transition_until_sleep: When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙",
"transition_until_sleep": "transition_until_sleep: This option ignores the current state of the sleep switch. When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning color temperature to these values after sunset. 🌙",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option ignores the current state of the sleep switch

When looking at the code, this is not obvious to me. Nor is it clear why this is desired behavior.

Copy link
Collaborator Author

@th3w1zard1 th3w1zard1 Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do apologize! It's difficult to write concise and clear documentation when the space to do so seems so limiting.

How's this?

Adaptive lighting changes your lights based on where the sun is in the sky. Normally, it stops changing your lights when the sun sets, but now with a new setting called "transition_until_sleep," it will gradually transition your lights to help you get ready for bed. Normally, these sleep settings are only used when you manually turn on sleep mode. With "transition_until_sleep," your lights will gradually dim until midnight, and then get brighter again in the morning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, adaptive lighting systems cease its adaptation after sunset, resulting in a potentially abrupt transition in lighting conditions. However, when the config option "transition_until_sleep," is true, adaptive lighting can continue to adapt to the user's environment beyond the sunset, gradually decreasing the color temperature of the lighting system to the user's preferred sleep settings. The adaptive lighting sleep settings are normally accessed using the adaptive_lighting.sleep_mode switch, which is typically activated by the user or automation when sleep mode is desired. The configuration option "transition_until_sleep" allows the adaptive lighting system to smoothly transition to the sleep settings, maintain those settings until midnight, and subsequently transition to the standard adaptive lighting values for the sunrise period.

Copy link
Owner

@basnijholt basnijholt Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, for the HA UI to display it properly, it needs to be brief. My proposal:

When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset instead of stopping at min_color_temp. 🌙

Also does this PR work when using color_temp during the day and sleep_rgb_color for the sleep switch?

Copy link
Owner

@basnijholt basnijholt Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I have a better idea. Let's remove transition_until_sleep and only have the two options you added.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transition_until_sleep is the combined form of adapt_brightness_until_sleep and adapt_color_until_sleep.
So it should be removed if we don't need to support backward compatibility. I've no opinion either way, but the PR in its current form will support backwards compatibility. It has only been a week though so that probably doesn't matter.

Another option is perhaps to soft-remove it? Leave it in the main code but remove it from the documentation?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a breaking change here would be fine especially since we only introduced it ≈1-2 weeks ago. We should just make it clear in the release notes.

@th3w1zard1 th3w1zard1 requested a review from basnijholt April 12, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants