-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Dim to warm #452
base: main
Are you sure you want to change the base?
Dim to warm #452
Conversation
** is exponent not ^
for real this time
remotes can possibly set brightness higher than predefined max/min brightness, use those as sources instead if they're greater/lower than what's set. May affect the curve.
# y = a(x-h)^2+k where h,k is the vertex (255,6500) or (max_brightness,max_ct) | ||
# a = (min_ct-max_ct)/(min_brightness-max_brightness)^2 | ||
# check: y = (1000-6500)/((1-h)^2)*(x-255)^2+6500 if x=2 then y=1043.221836 when min_brightness=1,max_brightness(h)=255,max_ct=6500,min_ct=1000 | ||
color_temp_kelvin = ((min_ct-max_ct)/(min_brightness-max_brightness)**2)*(brightness-max_brightness)**2+max_ct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reasoning behind this equation?
Do you perhaps have a graph or something that we can add to the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! please look at the issue #78 I have a graph posted toward the bottom of the thread
@basnijholt Why are the pre-commit filters so strict on formatting? Example: custom_components/adaptive_lighting/switch.py:836:101: E501 line too long (106 > 100) Do I need to fix all of these? |
The strict formatting is such that one never needs to have discussions about style. The filters dictate the style and that's it 😄
|
for more information, see https://pre-commit.ci
Still not accustomed to github workflow actions.
@basnijholt I don't quite understand these workflow actions. I'm confused by how to effectively use pre-commits but I'll figure it out as I get accustomed. My main concern is: why is pytest failing on all commits we are pushing? I went back in the timeline and it seems to even be failing on the |
for more information, see https://pre-commit.ci
just run |
I don't quite understand where I can run that command? I'm using GitHub desktop, but even when I open the terminal and try that command, I get:
|
You first need to install pre-commit itself with |
Yes there are 3 tests that are failing, which I want to get to. I am not sure whether the features that it is testing are actually broken or if it is because the test is bad. |
remove after testing.
One thing we could do, is to approximate the equation that Adaptive Lighting is using in Apple HomeKit. I personally have an unused Philips Hue Hub which I can set up with one of my Hue lights. Then I would let a light run for 24h at 100% brightness and poll the light each minute for its state with https://github.com/studioimaginaire/phue. We would then have a dataset which with we can determine how to implement this as in HomeKit. |
I can actually also come up with a scheme to sample all the brightnesses in a single day. I just need to program the sampling and experiment a bit. |
Brilliant!! |
6974e9c
to
c05e0cc
Compare
This functionality is similar to what I posted in #127 the intent is to allow parts of the day to change both brightness and color temp together instead of changing one or the other if the sun is above or below the horizon. |
Set color temp based on sun position AND current brightness. see #78
Calculates color_temp first, then uses that value as a max to then calculate again based on brightness in the following eq:
color_temp_kelvin = ((min_ct-max_ct)/(min_brightness-max_brightness)**2)*(brightness-max_brightness)**2+max_ct
when
brightness
is the current brightness.Just set
dim_to_warm: true
in the config to get started.Created from version 1.8.0