Apply lighting scene without turning the lights on

In my bedroom I have a IKEA Tradfri light, that I connect to HA through Zigbee2MQTT. Basic operation an automation of the light works fine, but I would like to have the light behave as follows:

Goal: When I turn on the light between 6am and 9pm I want the light to be full brightness, when I turn it on between 9pm and 6am I want the light to be at 25% brightness. I do not want to change the on/off state of the light when the switch to the new brightness happens. I do not want separate buttons for “bedroom daylight” and “bedroom nightlight” but a single “bedroom light” button that “knows what to do” at the time I push it.

I tried to set this up by turning on a scene via a time based automation, but a scene always requires the light to be switched on to change it’s brightness as it seems. Then I tried setting up one scene to change the brightness while also changing the state to on and a second one to change the state to off and have them run in sequence with the help of a script triggered by the time based automation, but this requires a delay of at least 200ms between the scenes causing the light to be on for 200+ms which is a bit annoying in a bedroom at 6am. Also this seems quite some effort for what seems to be a simple thing.

I’m quite new to HA and I can’t get rid of the feeling I am missing something obvious. Any pointers would be helpful.

1 Like

This is not possible. It is a limitation of the hardware. The only lights that I’m aware of that have the capability to change the brightness attribute while off is Lifx.

Instead of worrying about setting the light’s brightness while off, perhaps this would work instead:

An automation for “on” (or implements a ‘toggle’ behaviour) that checks to see what time it is, and turns the light on at the brightness appropriate for that time. (if you’d prefer toggle mode) it checks if the light is on and turns it off, else it’s off so the automation does as above and turns it on to a brightness relavant for the time of day).

Separately, the “Off” function is simple.
So, it could be done as two buttons, or as one button if you go with toggle as the way to handle the lamp.

Thanks for your hints and suggestions! Not being able to change settings when the device is off makes kind of sense :slight_smile:

I solved it with a combination of automations and scenes:

I created a scene for day light and night light with the correct color and brightness settings. Then I created two automations, one for turning on the day scene and the second for the night scene. The trick was to use the device state switching to on as the trigger and then setting the appropriate scene based on a time condition.

Works like a charm!

I set brightness to minimal before turning the lights off (my lights remember the last value before turning off, but there are lights such as Hue that can be set to a specific level each time they turn on) and, for the turn on command, an input number specifies the brightness value. The input number that controls the brightness can be changed based on time of the day or day of the week patterns.
Transition from brightness level 1 to something like 50% or 75% in the evening or 25% during the night takes very little and I find it easier on the eyes as compared to turning the lights on at 50% then working from there to 100% or 25%.
Also, if wanting to change the color alongside brightness from what was before off, turning the lights at level 1 kind of keeps the flickering at minimum.

I also tried that approach, but what I finally used is much easier to understand and adapt (at least for me).

How do you accomplish to set the brightness just before turning off?
I use Z Wave dimmers that when triggered by the associated wall switch immediately react, ie, turn off. With HA I can catch that state change, but would need to turn them on again to set brightness levels. This in turn triggers the Turn On Automation proposed above.

Any hints on this?

Can you provide more details such as what protocol (Zigbee/Z-wave/Wifi/Bluetooth/etc.) and brand (Hue/Xiaomi/etc.) are your lights and what automation are you using to control the lights, etc.?

AFAIK, Zigbee supports binding (eg. wall switch is associated with light bulb and does not need HA or a Zigbee hub to turn on/off) but I don’t know if it is possible with Z-wave without the controller being involved.

I use a Fibaro Z-Wave dimmer behind a wall switch to dim regular halogen spots. This dimmer reacts immediately on the switch input. My Z Wave devices communicate with an Aeonlab USB controller plugged into the PC running HA.

I use HA for controlling the lights via Smart Phone and to define scenes.