gguest64
(Franck FREMER)
1
Hello,
I’ve simple automation that turn on/off a light :
- alias: Light HUE RDC
description: ''
trigger:
- platform: state
entity_id: switch.din_rail_dimmer
action:
- service: "light.turn_{{ trigger.to_state.state }}"
target:
entity_id: light.entree_entree
data:
# brightness: 255
transition: 1
I would like to set specific data value for turn_on (brightness = 255 and transition = 1) and other data for turn_off (transition = 5).
What is the best way to do that ?
Thank you very much.
action: light.turn_{{ trigger.to_state.state }}
data: |
{{ {"brightness": 255, "transition": 1} if trigger.to_state.state == "on" else {"transition": 5} }}
target:
entity_id: light.entree_entree
gguest64
(Franck FREMER)
3
Thank you very much !
But with settings, the light ‘light.entree_entree’ does not turn on anymore (the transition = 5 work fine when turn off).
I had a typo… brightness_pct
instead of brightness
. I have fixed it above.
gguest64
(Franck FREMER)
5
Amazing, thank you very much !