Change light brightness/temperature without changing state

Hi there! I’m trying to make it so that my bathroom lights are set to a nice low brightness and warm temperature for overnight, so they’re not so jarring. I’m trying to do this with an automation, but it tells me that it must have state set. I didn’t want to do this, because someone might be in there and all of a sudden the lights going off it could get…messy. Any hints on what action I can set for this to happen? Many thanks!

1 Like

To set a light’s brightness and/or color_temperature, you must use the light.turn_on service. That’s what you must use in the automation’s action.

Yeah. what Taras said.
'Cept you could check if the light was already on thus ony fire the brightness/colour change if you actually switched the light from ‘off’ to ‘on’

Edit: Burnings suggestion (below) is pretty good but it does mean the lights flash on at each transition.
His suggestion is to change the ‘saved’ value as most lights turn on at their last setting, so if it was on durring the day (say bright cold light), you then turn it on at 03:00 (for that pee you desperately need because of all that beer) you will get blinded before the automation kicks in and brings is down again.
I have Fibaro dimmers which are all locally set to come on at a minimum set brightness - The price I pay is the ‘reverse’ they all come on dim and it takes a second to find the right setting (these are brightness only, no colour temp - the wife will only let me buy warm-white bulbs :roll_eyes: )

You can’t change the brightness without turning on the light.
One workaround is turning the lights on quickly, set them to the desired brightness and then turn them off again. To avoid turning the lights off when someone is on the toilet, you can crrate two automations, one that fires when the light is already on, which obly changes the brightness and one automation that fires only when the light is not on, which changes the brightness and then turns it off.

Or save the values (brightness etc…) in input numbers and in turn_on service use these as attributes. Then when motion sensor fires turn_on command it will use those input numbers. And those you can edit at any time.

I think some combination in these answers is the perfect thing.
Add a wait_template: "{{ is_state(light.light_id, 'off') }}" as the first action then a turn_on/turn_off. You get the flash, but nobody will be in there.
Thanks all!

Problem with this approach is that most lights turn on at full brightness before they change to the selected brightness.

Except as you turn the light off, you will see the flash as it comes back on setting to the new value.
Also if you set similar in your TV room (or other) and you are sitting in relative darkness watching a film etc. you will have the light flash on mid film - so not ideal for ALL situations

But then again, it’s an awkward task for most hardware, ideally they should let you set switch on brightness and colour without actually switching on (I don’t know of any :man_shrugging: )

Yeah I said that too :rofl:

1 Like

You can with lifx lights. They have a set_state service that does not require the light to be on. LIFX - Home Assistant

4 Likes

Thanks for the information, didn’t know that. Does this work for color as well?

:rofl:
Ha Ha Ha !!!

WAF will drop at least 50% with your soon to be wife, when you start ripping stuff out to replace with ‘lifx’

Anyway - I thought you were a Hue / Deconz Man ???

No it doesnt if you use turn_on service with automations and give brightness etc as attributes. If you turn on the light from the front end via direct light entity, the yes it does.

Are you sure ?
I mainly switch lights on at the switch
And mine always do a double take as HA needs to know that the light is on before it can adjust.

Edit: Or are you saying that you ‘always’ switch your lights via automations and thus it’s transparent ?

It already happened last Friday :innocent:

No, I’m not going to replace my beloved Hue/Deconz setup :rofl: Was just interested, I don’t have a use case for it, but it’s a topic that is discussed often here on the forum.

1 Like

Congratulations
:partying_face:

Edit: though I may have to comiserate with her (putting up with your backup strategies :tongue: )

1 Like

This poor soul even has to attach a USB stick to her keys, I don’t know how one is able to deal with me :rofl:

Ah Ha !
She is secretly a spy working for the Swiss-French
:female_detective:
She has submitted the ‘stick’ for them to ‘corrupt’ and is working through ALL your backups (in all 26 locations and their histories too) so that when you next boot all it says is : -

Your Ass is MINE !

And all your notifications saying the same !

:smiling_imp:

MUAHAHAAAAAAA !

1 Like

All true (I have LIFX bulbs) but it’s a feature unique to the LIFX platform and handled by a platform-specific service call. The topic’s author hasn’t mentioned the brand of bulbs in use so, unless it’s LIFX, they’re limited to using light.turn_on.

As a general rule, the light.turn_on service call is used to set a light’s parameters. You can’t, for example, use light.turn_off to set them in order to serve as a preset the next time the light is turned on. In addition, certain lighting attributes aren’t accessible when the light is off. For example, when off, a light entity has no brightness, rgb_color, hs_color, etc attributes.

1 Like

Just putting it out there as an option (change of hardware).

This is a bit off topic but it’s very interesting.
I’m not going to rip out what I have to change platform for this though.
I would say that if you change all your automations/scripts to use a virtual switch, you could use that to turn the light to minimum settings/colour for the next turn on (regardless of it’s next requirement) before actually turning off.
But that would be obviated should someone use the actual switch to turn it off.

(I know Teras (like me too) requires ‘things’ to be ‘operable’ should HA go down (always have a plan). This means ‘use the switch’ etc. Though I know ‘some’ people use ‘buttons’ next to/over the top of - I just can’t see me training the wife to choose the right button according to the situation (sod that, I couldn’t do it either) )