Hi, I would like to do a fade out (decrease brightness 5% every 10 seconds until it reach 1%, then it turn off the light) of my light bulb (entity: light.blub) once i press the switch (entity: switch.abc123). It should capture the brightness of the current brightness initially, for example, if the current brightness is 60%, it should decrease 5% starting from brightness 60% until the end, then turn off the light.
Really appreciate somebody can show me how the coding on this.
Also, if your light brightness is in percent then you will need to change that also.
I think you need to change “brightness” to “brightness_pct” and then modify the numbers to be in percentages instead of values between 1 and 255.
I try to use your coding to change the temperature of my RGB light bulb, but it doesn’t decrease the temperature gradually, it will strait away decrease the temperature to 250 or lesser. What’s wrong?
alias: Living hall door opened - Center car porch - increase brightness (Duplicate)
description: ''
trigger:
- platform: state
to: 'on'
entity_id: binary_sensor.a4b00034ac
attribute: state
condition:
- condition: time
after: '19:30:00'
before: '07:00:00'
action:
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.color5_cloud_586753
color_temp: "{{ state_attr('light.color5_cloud_586753', 'color_temp') | int - 15 }}"
- delay:
milliseconds: 250
until:
condition: template
value_template: "{{ state_attr('light.color5_cloud_586753', 'color_temp') | int <= 250 }}"
mode: single