Hello folks,
i use automation to dynamically change brightness level on Shelly Dimmer2. It would normally turn light on when off so i wanted to return to previous state, checking if it is actually turned on. Thus using more complex script to use same code for all dimmers.
What i can’t figure out is how to use template value in condition, something like
{{ is_state(’{{light_entity}}’, ‘on’)}} instead of fixed value {{ is_state(‘light.shellydimmer2’, ‘on’)}}
If i change to first option it always ends up false so my statement has to be wrong somehow.
Any advice?
script_setdimmerbrightness:
alias: SetDimmerBrightness
sequence:
- if:
condition: template
value_template: >
{{ is_state('light.shellydimmer2', 'on')}} 'this is where i want entity name sent to the script
then:
- service: light.turn_on
data_template:
entity_id: >
{{light_entity}}
brightness: >
{{custom_brightness}}
else:
- service: light.turn_on
data_template:
entity_id: >
{{light_entity}}
brightness: >
{{custom_brightness}}
- delay:
seconds: 1
- service: light.turn_off
data_template:
entity_id: >
{{light_entity}}
mode: queued