Open funkytwig opened 5 months ago
More info
I have been using Adaptive Lighting for about 4 months and up to now it has worked great. I even worked with the comunity ot get parameters added.
I am using
Home Assistant Operating System 11.4
HA 2024.1.3
Adaptive Lighting 1.20.0
I am getting an error when I go at the top of the HACKS page.
Not sure exactly when this happened. Think it was a couple of days ago. I have kept things up to date but dont think it was one of these updates that caused the problem, but guess it probably was.
Basically all the lights are set to their lowest all the time. Running the date command in ther terminal indicates the date and timezone are correct.
Also experiencing that. Used to work before.
Also mentioned in this issue: https://github.com/basnijholt/adaptive-lighting/issues/893
I believe the reason it's setting it to 1% is because it believe you're stuck in sleep mode, even if it's not night. There is a sleep mode switch. I'd confirm this is set to off.
Will check but it seems to only be a problem with zigbee bulbs.
I have the same issue since today without doing any updates.
I only have the issue if I set a min sunset
time or a max sunset time
other than None
.
Setting min
and max
sunset times to None
is a workaround for me for now.
I should have looked for this thread last week when the problem started :D.
Fiddling with the settings, only altering the integration's sleep mode brightness would address the issue. @WatsCo's suggestion to simply toggle sleep mode was on point! Though I'm not sure why it was enabled, assuming this controls whether the lights are currently in sleep mode (and not the sleep mode feature altogether) it's not clear to me how it got turned on in the first place. Or why it wouldn't have reset at sunrise anyhow.
I have automation that turns on/off the light and more importantly changes the lights colors during the day, so I'll report back if those trip sleep mode again. It's very possible there's an interaction here.
When I turn off sleep_brightness and Update it does not turn it off. When I go back in it is still checked. I have tried several times with different Inntergration Entries. The odd thing is I have 2 entries and one works and one does not. I have double checked they are the same. You can not turn off sleep mode on either, they are the same (except the lights) and one works and the other does not. Has anyone tried trying previous versions? Feels if this does not fix it the problem is related to code outside AL.
Relating to the above the one that worked was a new Integration Entry I created to troubleshoot the problem. The original one and the new one are both identical, and sleep mode can not be turned off for either but the old one has the problem and the new one does not.
Where are the config files can I look to see if there is something there that is not reflected in the UI?
So the workaround seems to be to create new entries and move lights over.
Could it be that your light doesn't correctly define min and max brightness, like:
min_color_temp_kelvin: 2202
max_color_temp_kelvin: 4000
as can be seen in homeassistant.local/developer-tools/state:
[Copy pasting this message in a few recent open issues]
I just wanted to take a moment to express my heartfelt thanks to everyone that is active in this repo. Your contributions, from answering questions to addressing issues, have been invaluable. It's amazing to see how supportive and helpful our community is!
Adaptive Lighting is all about enhancing your living spaces with smart, sunlight-responsive lighting. We've had quite a few discussions and open issues recently, and I see this as a positive sign of our community's engagement and growth. If you come across anything in the documentation that's unclear or if you have suggestions for improvement, please don't hesitate to share!. Your feedback is crucial for making Adaptive Lighting better for everyone.
On a personal note, I've recently welcomed twin boys into my family, which has been an incredible and life-changing experience. As you can imagine, my time is now more limited, and while I'm doing my best to keep up with the project, there may be delays in my responses. I appreciate your understanding and patience during this time.
Rest assured, I'm fully committed to addressing any bugs, especially those related to new Home Assistant updates, as swiftly as possible. I understand that many issues may stem from hardware limitations or misunderstandings about things like Zigbee groups. Your continued support and collaboration in helping each other out not only strengthen our community but also enhance the Adaptive Lighting experience for all.
Thank you once again for your understanding, patience, and support. Let's keep our houses well lit and adaptive for maximal enjoyment of life! 🌞🏠🌙
Okay with some additional logging I was able to identify the exact conditions on my system that causes the issue.
For the bug to happen I need to set min_sunset to the right range of value, currently in my area if I set it to 20:30:00 it causes the issue and the light becomes dark just after sunset.
Modified code generating the logs:
def noon_and_midnight(
self,
dt: datetime.datetime,
sunset: datetime.datetime | None = None,
sunrise: datetime.datetime | None = None,
) -> tuple[datetime.datetime, datetime.datetime]:
"""Return the (adjusted) noon and midnight times for the given datetime."""
if (
self.sunrise_time is None
and self.sunset_time is None
and self.min_sunrise_time is None
and self.max_sunrise_time is None
and self.min_sunset_time is None
and self.max_sunset_time is None
):
solar_noon = self.astral_location.noon(dt, local=False)
solar_midnight = self.astral_location.midnight(dt, local=False)
_LOGGER.error("BBB " + str(solar_noon) + " ////// " + str(solar_midnight))
return solar_noon, solar_midnight
if sunset is None:
sunset = self.sunset(dt)
if sunrise is None:
sunrise = self.sunrise(dt)
middle = abs(sunset - sunrise) / 2
if sunset > sunrise:
noon = sunrise + middle
midnight = noon + timedelta(hours=12) * (1 if midnight.hour < 12 else -1)
else:
midnight = sunset + sunset
noon = midnight + timedelta(hours=12) * (1 if midnight.hour < 12 else -1)
_LOGGER.error("AAA " + str(noon) + " ////// " + str(midnight) + " ------- " + str(sunset) + " /////// " + str(sunrise) + " //// " + str(middle))
return noon, midnight
The logs when the light is dark:
2024-04-03 22:31:28.078 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Kitchen: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.strip_kitchen_fridge, context_id=01HTJTHM8J:al:JNUX:ntrv:02, sleep_time=10.0, force=False, max_length=1, which=both, initial_sleep=False) 2024-04-03 22:31:28.079 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-02 12:01:44.656321+00:00 ////// 2024-04-02 00:01:44.656321+00:00 ------- 2024-04-02 18:30:00+00:00 /////// 2024-04-02 05:33:29.312643+00:00 //// 6:28:15.343678 2024-04-03 22:31:28.082 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-03 12:00:51.517689+00:00 ////// 2024-04-03 00:00:51.517689+00:00 ------- 2024-04-03 18:30:00+00:00 /////// 2024-04-03 05:31:43.035377+00:00 //// 6:29:08.482312 2024-04-03 22:31:28.084 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-04 11:59:58.549727+00:00 ////// 2024-04-04 23:59:58.549727+00:00 ------- 2024-04-04 18:30:00+00:00 /////// 2024-04-04 05:29:57.099455+00:00 //// 6:30:01.450272 2024-04-03 22:31:28.086 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-02 12:01:44.656321+00:00 ////// 2024-04-02 00:01:44.656321+00:00 ------- 2024-04-02 18:30:00+00:00 /////// 2024-04-02 05:33:29.312643+00:00 //// 6:28:15.343678 2024-04-03 22:31:28.088 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-03 12:00:51.517689+00:00 ////// 2024-04-03 00:00:51.517689+00:00 ------- 2024-04-03 18:30:00+00:00 /////// 2024-04-03 05:31:43.035377+00:00 //// 6:29:08.482312 2024-04-03 22:31:28.090 ERROR (MainThread) [custom_components.adaptive_lighting.color_and_brightness] AAA 2024-04-04 11:59:58.549727+00:00 ////// 2024-04-04 23:59:58.549727+00:00 ------- 2024-04-04 18:30:00+00:00 /////// 2024-04-04 05:29:57.099455+00:00 //// 6:30:01.450272
Notice how the computation for the last sunset is just shy of 48h after the sunset of the day before.
To fix the issue in my HA I changed (1 if midnight.hour < 12 else -1)
to just -1
. This is probably not a proper fix (this code probably fixed another corner case?) but the fact that it works with it confirms the source of the issue.
Home Assistant Adaptive Lighting Issue Template
Before submitting a bug report, please follow these troubleshooting steps:
Please confirm that you have completed the following steps:
Required information for bug reports:
Please include the following information in your issue.
Issues missing this information may not be addressed.
I have set AL using the Lovelace and do not know how to get the configuration. Looked at README and googled but no joy. Please point me to how to do this and I will add information. However, the configuration has been working for monthes and has not been changed.
When I turn the light on which used AL it always goes to 1%,
turn light to full then turn off and turn on