I try to combine my dimmer functions so, that I just need one. I tried hard but also because I am new don’t really understand what’s wrong. But the Light turns on and dimes fine but no chance it would turn off.
please help
YAML:`Preformatted text`
alias: Combined Dimmer Malte Light Control
description: "Handles turning on, off, and brightness changes of the Malte light."
trigger:
- platform: device
type: turned_on
device_id: 44cd16c43e2cc7411bc6785e7981a32b
entity_id: 8e319aee59679e4626da5aee849a5994
domain: light
- platform: device
type: turned_off
device_id: 44cd16c43e2cc7411bc6785e7981a32b
entity_id: 8e319aee59679e4626da5aee849a5994
domain: light
- platform: state
entity_id: light.dimmer_malte_tze
attribute: brightness
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.platform == 'device' and trigger.type == 'turned_on' }}"
sequence:
- service: light.turn_on
target:
entity_id:
- light.decke_malte
- conditions:
- condition: template
value_template: "{{ trigger.platform == 'device' and trigger.type == 'turned_off' }}"
sequence:
- service: light.turn_off
target:
entity_id:
- light.decke_malte
- conditions:
- condition: template
value_template: "{{ trigger.platform == 'state' and trigger.to_state.attributes.brightness is not none }}"
sequence:
- service: light.turn_on
data_template:
entity_id: light.decke_malte
brightness_pct: >-
{{ (trigger.to_state.attributes.brightness | float / 255.0 * 100.0) | round(0) }}
mode: single