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

Brightness continues to drop long after it's dark #210

Open
cssinate opened this issue Dec 10, 2022 · 3 comments
Open

Brightness continues to drop long after it's dark #210

cssinate opened this issue Dec 10, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@cssinate
Copy link

I've just got this up and running for the first time today. Based on my observations and the charts you show in the README, it seems like the Brightness value continues to go down while the sun gets further and further away, even though the apparent darkness of the sky doesn't change noticeably. Here in eastern Canada, it's completely black by 6:30pm. I'd prefer that the light be at its lowest level by the time it's completely dark out, and stay at the lowest until the sky starts to lighten again. Is that possible?

@claytonjn
Copy link
Owner

it seems like the Brightness value continues to go down while the sun gets further and further away, even though the apparent darkness of the sky doesn't change noticeably

Yes, that is correct

Here in eastern Canada, it's completely black by 6:30pm.

I'm in Michigan and it's completely dark by 5:30pm here 😂

I'd prefer that the light be at its lowest level by the time it's completely dark out, and stay at the lowest until the sky starts to lighten again. Is that possible?

There's currently no way to achieve this behavior with the current code. It is possible from a technical standpoint but my hesitation for adding features like this is that the component already has a lot of configuration options and can be overwhelming and confusing for users to understand, so I worry that adding more options will make it that much worse. It would require two additional configuration options, likely min_brightness_start_time and min_brightness_end_time but I assume you don't want to change those throughout the year which would also require additional settings such as min_brightness_start_sunset_offset and min_brightness_end_sunrise_offset, but even then because of the tilt of the Earth those offset likely wouldn't work throughout the year.

The best solution would be to correlate brightness with the actual solar elevation, but I'm not aware of an API which provides the maximum/minimum elevations and the time those occur on a given day and that information would be necessary for calculations because it changes throughout the year. (As an aside, the "holy grail" for accurate circadian color temperature would be an equation that correlates solar elevation with color temperature, but I have not found enough data to create or borrow one)

The only other solution I can think of would be to add an option like min_brightness_at_night which would change the behavior to dim between sunset and night (The time between astronomical dusk of one day and astronomical dawn of the next) and brighten between night and sunrise. Just doing a quick check, Astral lists night as starting at 5:32p for me tonight which seems accurate for when it starts being darkest, but it lists night as ending at 7:20am and I think 7:10am is likely more accurate - I'd have to do some more experimenting with dusk, blue hour, etc to see what is most accurate.


I'm going to mark this as an enhancement. Can you tell me, what would you like to see in terms of configuration? For your use-case, do you just want the brightness to more accurately follow the sun and change automatically throughout the year, or do you want to be able to set specific times or offsets?

@cssinate
Copy link
Author

cssinate commented Dec 10, 2022 via email

@claytonjn claytonjn added the enhancement New feature or request label Dec 10, 2022
@claytonjn
Copy link
Owner

Here's a dump of all of the relevant times for today (putting this here for my future self when I get time to work on implementing this)

2022-12-10 11:00:49.450 WARNING (MainThread) [custom_components.circadian_lighting] dawn: 2022-12-09 07:19:18.276505-05:00
2022-12-10 11:00:49.452 WARNING (MainThread) [custom_components.circadian_lighting] sunrise: 2022-12-09 07:51:48.397107-05:00
2022-12-10 11:00:49.455 WARNING (MainThread) [custom_components.circadian_lighting] sunset: 2022-12-09 16:59:50.065172-05:00
2022-12-10 11:00:49.456 WARNING (MainThread) [custom_components.circadian_lighting] dusk: 2022-12-09 17:32:19.845430-05:00
2022-12-10 11:00:49.459 WARNING (MainThread) [custom_components.circadian_lighting] night: (datetime.datetime(2022, 12, 9, 17, 32, 19, 845430, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>), datetime.datetime(2022, 12, 10, 7, 20, 8, 412206, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>))
2022-12-10 11:00:49.460 WARNING (MainThread) [custom_components.circadian_lighting] twilight: (datetime.datetime(2022, 12, 9, 7, 19, 18, 276505, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>), datetime.datetime(2022, 12, 9, 7, 51, 48, 397107, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>))
2022-12-10 11:00:49.462 WARNING (MainThread) [custom_components.circadian_lighting] golden_hour: (datetime.datetime(2022, 12, 10, 8, 36, 45, 539185, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>), datetime.datetime(2022, 12, 10, 7, 32, 8, 335207, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>))
2022-12-10 11:00:49.463 WARNING (MainThread) [custom_components.circadian_lighting] blue_hour: (datetime.datetime(2022, 12, 10, 7, 32, 8, 335207, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>), datetime.datetime(2022, 12, 10, 7, 20, 8, 412206, tzinfo=<DstTzInfo 'America/Detroit' EST-1 day, 19:00:00 STD>))

Looking at some camera footage, I would say that at the time of this dump it starts getting dark at ~5:15p and is completely dark by ~5:40p, and that it starts getting light at ~6:55a and is completely light by ~7:22a.

I also have a min/max lux sensor which is an average of a bunch of outdoor hue sensors I have around the outside of my house. It looks like they get to the lowest around ~5:20p and remain there until ~7:25p

image

image

So it looks like to simulate actual brightness, the closest would be for lights to dim from sunset to the start of night, then remain at min_brightness until the end of night and then dim up until sunrise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants