-
Notifications
You must be signed in to change notification settings - Fork 0
/
rgb-control.yml
174 lines (159 loc) · 3.59 KB
/
rgb-control.yml
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
substitutions:
node_name: rgb-control
device_verbose_name: "RGB Control"
ip_suffix: "31"
ap_password: "y0ltlm7Rryim"
board_type: esp32dev
packages:
wifi: !include common/wifi.yml
device_base: !include common/device_base.yml
# https://esphome.io/index.html#
esphome:
includes:
- custom/glow.h
- custom/glow
libraries:
# - esphome/FastLED=https://github.com/FastLED/FastLED.git
# Enable Home Assistant API
api:
encryption:
key: "THGSFcmxAmRLb5PSvpDS7nEBZCeYwe2x+24T0x2OyEw="
password: ""
# https://esphome.io/components/light/index.html
light:
- platform: partition
name: "Grid"
id: 'grid0'
segments:
- id: strip0
from: 0
to: 8
- id: strip1
from: 0
to: 8
- id: strip2
from: 0
to: 8
- id: strip3
from: 0
to: 8
on_turn_on:
then:
- lambda: |-
id(grid_on) = true;
on_turn_off:
then:
- lambda: |-
id(grid_on) = false;
effects: !include custom/grid_effects.yml
- platform: fastled_clockless
name: "Grid Section 1"
id: strip0
chipset: NEOPIXEL
num_leds: 9
pin: GPIO33
- platform: fastled_clockless
name: "Grid Section 2"
id: strip1
chipset: NEOPIXEL
num_leds: 9
pin: GPIO14
- platform: fastled_clockless
name: "Grid Section 3"
id: strip2
chipset: NEOPIXEL
num_leds: 9
pin: GPIO27
- platform: fastled_clockless
name: "Grid Section 4"
id: strip3
chipset: NEOPIXEL
num_leds: 9
pin: GPIO13
- platform: fastled_clockless
name: "Strip"
id: strip4
chipset: WS2811
rgb_order: BRG
num_leds: 30
pin: GPIO26
effects: !include custom/strip_effects.yml
on_turn_on:
then:
- lambda: |-
id(strip_on) = true;
on_turn_off:
then:
- lambda: |-
id(strip_on) = false;
# https://esphome.io/components/sensor/index.html
sensor:
- platform: rotary_encoder
name: "Brightness"
id: 'rotary1'
pin_a:
number: GPIO18
inverted: true
mode:
input: true
pin_b:
number: GPIO5
inverted: true
mode:
input: true
pullup: true
min_value: 0
max_value: 100
unit_of_measurement: "%"
publish_initial_value: true
on_value:
then:
- light.turn_on:
id: grid0
brightness: !lambda |-
// output value must be in range 0 - 1.0
return id(rotary1).state / 100.0;
- light.turn_on:
id: strip4
brightness: !lambda |-
// output value must be in range 0 - 1.0
return id(rotary1).state / 100.0;
# https://esphome.io/components/switch/index.html
switch:
- platform: template
id: led_toggle
name: "Toggle Switch"
optimistic: true
on_turn_on:
then:
- light.turn_on: grid0
- light.turn_on: strip4
on_turn_off:
then:
- light.turn_off: grid0
- light.turn_off: strip4
# https://esphome.io/guides/automations.html?highlight=template#global-variables
globals:
- id: grid_on
type: bool
restore_value: yes
initial_value: 'false'
- id: strip_on
type: bool
restore_value: yes
initial_value: 'false'
- id: grid_columns
type: uint16_t
restore_value: no
initial_value: '9'
# https://esphome.io/components/binary_sensor/index.html
binary_sensor:
- platform: gpio
name: "Toggle Button"
pin:
number: GPIO19
mode:
input: true
on_press:
then:
- switch.toggle: led_toggle