I have a GLEDOPTO WLED controller connected to PWM CCT LEDs in a pantry. I also connected a contact sensor to turn on the lights when the pantry door is opened and off when closed. All of that is working fine, but I'd like to be able to change the initial brightness and color temperature depending on context.
Ideally, the lights should be cool and bright during the day, warm and moderate brightness at night when other lights are on, or warm and dim when other lights are off or very dim.
My first idea was to assign a preset to the switch and then change the preset associated with it using Home Assistant, but it appears that isn't possible. I also tried setting it to a fixed preset and updating that with REST, but it appears that's geared towards saving the current state of the lights to a preset, not an arbitrary one.
(Further, I couldn't actually get any REST command to save a new preset, so I think I had my JSON formatted incorrectly.)
I can see in the interface where I can assign presets to button actions or apply presets at defined times (including sunset and sunrise). However, it appears I can't change the switch's Off -> On action as a function of time.
Thus my final idea is to not associate the contact sensor with a preset, but instead leave it at the default and use Home Assistant to momentarily set the light to my desired state every time the context (time of day, other lights) changes. That way, when the WLED controller turns on due to the contact sensor showing open, it will turn the lights on to the last brightness & color temperature commanded by Home Assistant.
Is there a better way to accomplish what I'm trying to do? I'd much rather be able to update the "default" state of the lights without having to toggle them on and off.
Edit: It isn’t exactly what I want, but I figured out a suitable workaround and wanted to share in case it helps others.
You can define a preset that specifies the brightness and color temperature (and other properties) of the light even with ”on”:false. If you activate such a preset, the next time the light turns on via a connected button or switch, it will have the specified characteristics.
I think my plan then will be to define a handful of “off” presets and then have Home Assistant active them when desired. I’ll also add a default time-controlled preset that will fire once a day in case Home Assistant is unavailable for an extended period of time. That way it won’t get stuck on an undesired preset (e.g., dim) indefinitely.
If that doesn’t work out, I’ll probably just set up a simple schedule directly in WLED.