-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstardestroyerlights.yaml
188 lines (164 loc) · 5.02 KB
/
stardestroyerlights.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
esphome:
name: stardestroyerlights
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
# manual_ip:
# static_ip: 192.168.1.134
# gateway: 192.168.1.1
# subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Stardestroyerlights"
password: !secret esphome_fallback_pass
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "ithurtswhenIP"
ota:
password: "ithurtswhenIP"
e131:
method: unicast
light:
- platform: fastled_spi
id: ssdlights
chipset: WS2801
data_pin: D2
clock_pin: D1
num_leds: 28
rgb_order: RGB
default_transition_length: 2s
name: "SSDlights"
gamma_correct: 1.5
effects:
- random:
- addressable_rainbow:
width: 28
- addressable_lambda:
name: Wheel of Color
update_interval: 100ms
lambda:
ESPColor colors[] = { ESPColor(255,0,0),
ESPColor(0,255,0),
ESPColor(255,255,0),
ESPColor(0,0,255),
ESPColor(255,82,0),
ESPColor(163,0,255),
};
static int state = 0;
static int step = 0;
const int color_size = 6;
static int width = it.size();
for (int i = it.size() - 1; i > 0; i--) {
it[i] = it[i - 1].get();
}
it[0] = colors[state];
step += 1;
if (step >= width){
step = 0;
state += 1;
if (state >= color_size)
state = 0;
}
- addressable_lambda:
name: "My Custom Effect"
update_interval: 20ms
lambda: |-
static int progress = 0;
static int width = it.size();
static bool brightleds [28];
float ledcolor [3];
if (initial_run) {
progress = 0;
}
// it.size() - Number of LEDs
// it[num] - Access the LED at index num.
// Set the LED at num to the given r, g, b values
// it[num] = ESPColor(r, g, b);
// Get the color at index num (ESPColor instance)
// it[num].get();
// Move the fully lit spots one point across the strip
for (int i = 0; i < it.size()-1; i++) {
brightleds[i] = brightleds[i + 1];
}
// Example: Simple color wipe
// for (int i = it.size() - 1; i > 0; i--) {
// it[i] = it[i - 1].get();
// }
// Slowly fade out LEDs
for (int i = 0; i < it.size()-1; i++) {
it[i] = it[i].get() - 30;
}
int random, red, green, blue;
random = rand() % 20;
red = rand() % 100 + 50;
green = rand() % 100 + 50;
blue = rand() % 100 + 155;
// Determine if we make a new bright point at the start of the strip:
if (random == 1) {
brightleds[width] = true;
brightleds[width-1] = true;
} else {
brightleds[width] = false;
brightleds[width-1] = false;
}
// And now set the new bright LEDs
for (int i = 0; i < it.size()-1; i++) {
if (brightleds[i]) {
// it[i] = ESPColor(255, 235, 235);
it[i] = current_color;
}
}
// if (progress < 5) {
// it[it.size()-1] = ESPColor(255, 235, 235);
// } else if (random == 4) {
// it[it.size()-1] = ESPColor(red, green, blue);
// progress = 0;
// }
progress++;
- e131:
universe: 1
channels: RGB
- platform: fastled_spi
id: ssdlights_inner
chipset: WS2801
data_pin: D4
clock_pin: D3
num_leds: 20
rgb_order: RGB
default_transition_length: 2s
name: "SSDlights inner"
gamma_correct: 1.5
effects:
- random:
- addressable_rainbow:
width: 20
- lambda:
name: Pulse RED
#// SPEED
update_interval: .0s
lambda: |-
static float in = 0;
static float out = 0;
// Scale sin output from -1/1 to 0/1
out = sin(in) * 0.3 + 0.7;
auto call = id(ssdlights_inner).turn_on();
call.set_transition_length(100);
// COLOR + BRIGHTNESS
call.set_rgb(1.0, 0.0, 0.0);
call.set_brightness(out);
// Do not publish state to eliminate flooding of logs
call.set_publish(false);
call.set_save(false);
call.perform();
// RESOLUTION
in += 0.0314;
if (in > 6.283)
in = 0;
- e131:
universe: 2
channels: RGB