I’ve been trying to figure out how to do this as well. At least for the dimmer switches I am using the following seems to be working flawlessly:
- service: scene.apply
data_template:
entities:
light.your_light:
# Keep current state
state: "{{ states('light.your_light') }}"
brightness: 1 # or whatever brightness you want the lights to switch to
This will do a couple of things:
Apply the new brightness level to the light regardless of if the light is currently on or off.
Retain the lights current state and not turn it off or on when it is already on or off respectively.
Would love to hear if this works for other people too or if this working is a fluke with my dimmers.
Which lighting integration are you using to control your dimmers?
I intend to try it on my system but I suspect the behavior you’ve reported may be dependent on the integration.
UPDATE
I tried it with lights that are based on the MQTT integration and the scene.apply trick did not work.
Experiment:
Turn light on to full brightness then turn off.
Call scene.apply to set the light to off and set brightness to 100.
Turn on light without setting brightness.
Light turns on to full brightness (255) and not the brightness level specified in scene.apply.
Basically, the light is not using the brightness level set by scene.apply as its default brightness level.
I know this is possible but it depends on the lighting technology and if the integration implements it correctly.
I’m using the Samsung SmartThings integration with GE Zwave Motion Dimmers and custom device handlers by Michael Struck on the SmartThings side. I plan on migrating them to use Home Assitant’s Z-Wave integration directly soon. Will report back if I can still get this to work at that point or not.
I should have been more clear: I have LIFX bulbs that support changing the color/brightness while the light is “off” and without changing the state of the light, yet I cannot accomplish this in HomeAssistant.
Are there plans to support this in the future, for devices that have this feature?
My understanding and experience is that currently HomeAssistant does not support this regardless of whether the device’s firmware/api supports it.
I have a treatlife DS01C dimmer switch flashed with Tasmota. This also supports changing brightness/dimmer level without changing the state of the switch on. For now, I’ll have to set an automation using the HTTP API to send a brightness setting. This seems like it would be a feature many people want and it could be implemented somehow in HA if enough people show interest.
Use cases are like above. I want to set the bathroom lights to turn on the dimmest possible setting after criteria (basically night time rest of house lights are off) and revert back to full bright during the day and before everyone is asleep. With HA direct, the only way I see is to turn the light on, to the new setting, then turn the light off.
I’m using this shell command for a tasmota dimmer switch, but I really think this would be a useful feature to include in HA master_bath_light_10percent: curl -s -o /dev/null http://1.2.3.4/cm?cmnd=Dimmer%2010
Apologies for resurrecting this but exactly the right topic I am after.
I’m just starting out with HA (coming from a different platform) and really like it, except that not having this functionality could be a deal breaker for me.
I have 3 sets of lights:
LightwaveRF (via homekit intergration)
Lifx
Shelly (Dimmer2 and RGBW)
Shelly and Lightwave ones have a physical switch that I use regularly and would therefore like the brightness to be adjusted whilst they are off, so that when someone hits the physical switch, it comes on at the correct brightness for that time.
I can do it with the other platform for all of them but seems like only Lifx has that option with HA.
Can you post the complete code for one light? I am not a programmer and can not get it to work. My entity stays grayed out in the Lovelace card.
Thanks in advance.
This did only work because of the specific details of the implementation of the light device handler in SmartThings.
As other have pointed out, you will need to use your platforms specific implementation for setting brightness or other attributes while the light is off – if that even exists.
@123 Pointed out above how to do this for LIFX bulbs. If you are using GE Z-Wave Smart Motion Dimmers (which I am) you can set the Z-Wave parameter 17 on them to set the brightness default level (i.e. their brightness when they turn on without an explicit brightness value):