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