Hi there,
The light.turn_on
service takes parameters that the light.turn_off
service does not take. One example is “color_name”.
Put simply, my intention behind this feature request is to advocate for the addition of those parameters in the light.turn_off
service for parity.
My use case is below. I should also note that it is entirely possible I am missing something incredibly basic, and if that is the case, I apologize for wasting the community’s time.
- I have a light blueprint that I wrote for myself that controls all the lights in the house, used by 20 or so automation.
- The blueprint binds a binary template sensor, a light entity, and a timer.
- There are custom attributes defined on the binary sensor that indicate color value and brightness. The state of the template sensor is used to determine if the light should be on or off.
So, here’s the use case I am struggling with. The blueprint has triggers for both attribute changes as well as state changes, and operates in a “single” mode.
I have lights behind my bed’s headboard that are on at 100% brightness in a warm-ish color tone. When we start going to sleep, the goal is for the lights to fade down from 100% brightness to 0, as well as the color to change to red, simultaneously - simulating a sunset. I am using a transition value of 600 (10 minutes) for this operation today.
However, since the light.turn_off service doesn’t support a color parameter, the only way to implement this (I think) would be to call light.turn_on with a brightness value of 1, transition of 600, and color of red. Once complete, turn the light off.
That’s a bit hacky and it’d be cleaner if I could pass a color in the light.turn_off service.
I am not sure whether different light firmware’s support this or not, so that might be a good reason not to do this FR.
I know that some lights support the “transition” field and some don’t, so obviously if we did do this it might be the case that only some lights support it.
The key here IMHO is that because the “transition” property can be passed to the light.turn_off service, it implies it’s possible it is not necessarily an immediate turn off, but rather a mutation of the light’s state over a period of time, defined by the value of the transition field.
You can mutate the brightness in this way, so why not the color, as well?
From a semantics perspective, I am struggling with the mode of the blueprint. I believe once the light receives the first command, it effectively ignores subsequent commands during the transition period, so it’s a bit challenging.
Again I could be missing something very basic here!
Please let me know if anyone needs the blueprint code or template sensor code, but hopefully it’s clear.
Thanks!
Matt