configuration.yaml
Kopieren 1 # PWM LED Dimmer
2 # Steuert einfarbige LEDs oder LED-Streifen über PWM
3 output :
4 - platform : ledc
5 pin : GPIO5
6 frequency : 1000Hz # PWM-Frequenz (1kHz verhindert sichtbares Flackern)
7 id : pwm_output
8 channel : 0
9
10 light :
11 - platform : monochromatic
12 output : pwm_output
13 name : "${friendly_name} Dimmable Light"
14 id : dimmable_light
15 default_transition_length : 1s
16 gamma_correct : 2.8 # Natürlichere Helligkeitskurve
17 restore_mode : RESTORE_DEFAULT_OFF
18 effects :
19 - pulse :
20 name : "Pulse"
21 transition_length : 1s
22 update_interval : 2s
23 min_brightness : 10%
24 max_brightness : 100%
25 - strobe :
26 name : "Strobe"
27 colors :
28 - state : true
29 brightness : 100%
30 duration : 500ms
31 - state : false
32 duration : 500ms
33 - lambda :
34 name : "Breathing"
35 update_interval : 50ms
36 lambda : | -
37 static uint16_t progress = 0;
38 float brightness = (sin(progress * 0.02) + 1.0) / 2.0;
39 auto call = id(dimmable_light).turn_on();
40 call.set_brightness(brightness);
41 call.perform();
42 progress++;
43
44 # Optional: Manuelle Helligkeitssteuerung über Number-Komponente
45 number :
46 - platform : template
47 name : "${friendly_name} Brightness"
48 id : manual_brightness
49 min_value : 0
50 max_value : 100
51 initial_value : 50
52 step : 1
53 unit_of_measurement : "%"
54 mode : slider
55 optimistic : true
56 set_action :
57 then :
58 - light.turn_on :
59 id : dimmable_light
60 brightness : !lambda 'return x / 100.0;'
61
62 # Optional: Vordefinierte Helligkeits-Buttons
63 button :
64 - platform : template
65 name : "${friendly_name} Dim"
66 icon : "mdi:brightness-5"
67 on_press :
68 - light.turn_on :
69 id : dimmable_light
70 brightness : 25%
71
72 - platform : template
73 name : "${friendly_name} Medium"
74 icon : "mdi:brightness-6"
75 on_press :
76 - light.turn_on :
77 id : dimmable_light
78 brightness : 50%
79
80 - platform : template
81 name : "${friendly_name} Bright"
82 icon : "mdi:brightness-7"
83 on_press :
84 - light.turn_on :
85 id : dimmable_light
86 brightness : 100%
87
88 # Optional: Sanftes Ein-/Ausschalten mit Überblendung
89 script :
90 - id : smooth_on
91 then :
92 - light.turn_on :
93 id : dimmable_light
94 brightness : 100%
95 transition_length : 2s
96
97 - id : smooth_off
98 then :
99 - light.turn_off :
100 id : dimmable_light
101 transition_length : 2s