I thinked first that it was due to phue.py library, but I had the same behavior with yeelight bulbs.
The light.turn_on function was probably updated. Too bad, this trick was useful.
Here was my approach to brighten stairway light then return to previous state :
##############################
- alias: Light Stairway Bright
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d000130d5ed
from: 'off'
to: 'on'
action:
- service: light.turn_on
entity_id: light.stairway
data_template:
brightness: '{{ ((states.light.stairway.attributes.brightness or 0) + 150) | min(255) }}'
##############################
- alias: Light Stairway Back
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d000130d5ed
from: 'on'
to: 'off'
action:
- service: light.turn_on
entity_id: light.stairway
data_template:
brightness: '{{ ((states.light.stairway.attributes.brightness or 0) - 150) | max(0) }}'
That’s unfortunate. I just ran a test and brightness-0 still performs an “off” for zwave lights. But (lazy), I’m still at .45. I’ll make an image of my card and upgrade and check things out at .47…
@ih8gates How would I adapt this to not change the brightness of a dimmer if it happens to already be on? My use case is the dining room chandelier where I want it to turn on dimply (30%) when someone triggers a motion/door sensor for 5-10 min and then turn off when no motion is detected. However, I don’t want it to adjust the level to 30% in the event that I’m having dinner in the room and the light is already on. Make sense?
Yup. Sorry - I had been experimenting with a check to see if the light had been changed by this motion sensing, or if it had just been turned on because of time-of-day, etc. So it’s not necessary here.
@ih8gates did you upgrade to the newest version 0.51.2? I’m seeing that your script appears to no longer save the last light level anymore. Can you confirm?
Hmm no dice. Tho I’m using mqtt home base lights, so storing just the brightness is prob not enough.
I’ll see if I can figure out away to achieve this as I use flashing my light red as a warning, but still wanna have them return to normal rather than off after the alert.
No comment about the code discussed in this topic, since I really haven’t taken the time to digest it. But, if you’re looking for a way to save the state of lights and/or switches so that you can return them to the same state at a later time, you might be interested in this: