I am trying to turn on a light over time so that it reaches 100% brightness slowly.
To see whether the transition is working I currently have the transition set to 25 seconds, I’ll adjust later.
When I run the action it goes straight to 100% brightness without ever transitioning. No matter what I try it’s always the same result.
How can I get this to work? I thought the transition would take care of it automatically, documentation is spectacularly lacking and I wasn’t able to find any answer by googling it, none of the proposed solutions work.
The answer is that depends on the hardware - Home Assistant doesn’t itself handle transitions - it passes the instruction to the hardware. For example - I can happily send transition commands to my Zigbee lights connected via Zigbee2MQTT, but my ZWave bulbs ignore transition commands and just immediately go to the requested brightness.
Could this be done another way, say with a script?
I’ve been trying to understand how to implement them and I even saw some python examples but the documentation is lacking as to how to actually integrate them?
Sure, here is a script I use to gradually increase the volume of Google Nest speakers - this can easily be adapted to change light brightness instead of media volume.
Here is what I use to transition my deck light at sunset over about 15 minutes:
- alias: LC Deck Light Fade On at Dusk
initial_state: 'on'
mode: restart
trigger:
- platform: state
entity_id: sensor.dark_outside
to: 'true'
- platform: sun
event: sunset
offset: "+00:07:00"
condition:
- condition: state
entity_id: light.deck_light_0a4c
state: 'off'
action:
- service: light.turn_on
data:
entity_id: light.deck_light_0a4c
brightness: 5
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.deck_light_0a4c
brightness: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int + 1 }}"
- delay: 2
until:
condition: or
conditions:
- condition: template
value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int >= 254 }}"
- condition: state
entity_id: light.deck_light_0a4c
state: 'off'
the only issue is that if HA gets restarted or automations get reloaded during the transition it will be stuck there. So I use this one to resume the transistion: