-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification_light.yaml
180 lines (165 loc) · 4.15 KB
/
notification_light.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
substitutions:
#id_code: "unique" # for differentiating multiple devices
devicename: notification-light-${id_code}
# General Parameters
refresh_interval: 10s
light_effect_interval: 16ms
mqtt_topic_prefix: esphome/notification-light # /${id_code}/notify/${color} for each color
length_mqtt_topic_prefix: "26" # need this to match ${id_code} and * in the MQTT subscription
# GPIO Pins
led_pin: D4
# Color Parameters
num_colors: "6"
color_values: |-
{
Color(255,0,0,0), // red
Color(0,255,0,0), // green
Color(0,0,255,0), // blue
Color(255,255,0,0), // yellow
Color(0,255,255,0), // cyan
Color(255,0,255,0) // magenta
}
color_names: '{ "red", "green", "blue", "yellow", "cyan", "magenta" }'
empty_array: "{ 0,0,0,0,0,0 }"
# Button Parameter
debug_duration: "60" # (in seconds)
packages:
wifi: !include fragments/common/wifi.config.yaml
device_base: !include fragments/common/device_base.config.yaml
esphome:
platform: ESP8266
board: d1_mini
on_boot:
priority: -200
then:
- light.turn_on:
id: notification_light
effect: "Notification Effect"
time:
- platform: sntp
id: sntp_time
globals:
- id: colors
type: Color[${num_colors}]
initial_value: ${color_values}
- id: pending_notifications
type: time_t[${num_colors}]
initial_value: ${empty_array}
- id: notification_received
type: time_t[${num_colors}]
initial_value: ${empty_array}
#text_sensor:
# - <<: !include fragments/text_status.config.yaml
interval:
- interval: ${refresh_interval}
id: the_interval
then:
- script.execute: clean_overdue_notifications
# - component.update: txt_notifications
script:
- <<: !include fragments/script_clean_overdue.config.yaml
mqtt:
topic_prefix: ${mqtt_topic_prefix}/${id_code}
on_message:
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 0
color: red
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 0
color: red
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 1
color: green
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 1
color: green
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 2
color: blue
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 2
color: blue
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 3
color: yellow
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 3
color: yellow
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 4
color: cyan
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 4
color: cyan
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: ${id_code}
index: 5
color: magenta
- <<: !include
file: fragments/mqttsub.config.yaml
vars:
topic: "*"
index: 5
color: magenta
button:
- <<: !include
file: fragments/button.config.yaml
vars:
color: red
- <<: !include
file: fragments/button.config.yaml
vars:
color: green
- <<: !include
file: fragments/button.config.yaml
vars:
color: blue
- <<: !include
file: fragments/button.config.yaml
vars:
color: yellow
- <<: !include
file: fragments/button.config.yaml
vars:
color: cyan
- <<: !include
file: fragments/button.config.yaml
vars:
color: magenta
light:
- <<: !include
file: fragments/light.config.yaml
vars:
pin: ${led_pin}