Hi, I need to change the brightness of a LED based on the status of two entities. I’m testing with this automation but it doesn’t work
- alias: INTERRUPTOR
trigger:
platform: state
entity_id: binary_sensor.interruptor
to: 'on'
action:
- service: light.toggle
data:
entity_id: light.bombilla
- alias: on_off
trigger:
platform: state
entity_id: input_boolean.control_led
platform: state
entity_id: light.bombilla
action:
service: light.toggle
entity_id: light.led_interruptor
data_template:
brightness: >
{% if is_state('input_boolean.control_led', 'on') and is_state('light.bombilla', 'on') %}
130
{% elif is_state('input_boolean.control_led', 'off') and is_state('light.bombilla', 'off') %}
0
{% elif is_state('input_boolean.control_led', 'on') and is_state('light.bombilla', 'off') %}
50
{% elif is_state('input_boolean.control_led', 'off') and is_state('light.bombilla', 'on') %}
130
{% else %}
none
{% endif %}