-
Notifications
You must be signed in to change notification settings - Fork 1
/
wopr.yaml
187 lines (168 loc) · 3.46 KB
/
wopr.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
esphome:
name: "wopr"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
services:
- service: update_text
variables:
wopr_display: string
then:
- text_sensor.template.publish:
id: wopr_display
state: !lambda 'return wopr_display;'
- script.execute: restore_clock
- service: update_text_with_timeout
variables:
wopr_display: string
timeout: int
then:
- text_sensor.template.publish:
id: wopr_display
state: !lambda 'return wopr_display;'
- number.set:
id: text_timeout
value: !lambda 'return timeout;'
- script.execute: restore_clock
ota:
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-WOPR"
password: !secret wifi_password
captive_portal:
external_components:
- source:
type: git
url: https://github.com/ssieb/custom_components
components: [ ht16k33_alpha ]
time:
- platform: homeassistant
id: my_time
#BUTTONS
binary_sensor:
- platform: gpio
pin: 14
name: BTN1
filters:
- delayed_on: 10ms
- platform: gpio
pin: 15
name: BTN2
filters:
- delayed_on: 10ms
#HAXORZ_EDITION
- platform: gpio
pin: 32
name: BTN3
filters:
- delayed_on: 10ms
- platform: gpio
pin: 33
name: BTN4
filters:
- delayed_on: 10ms
#RGB LEDS
light:
- platform: neopixelbus
type: GRB
variant: WS2811
pin: 27
num_leds: 5
name: "DEFCON"
id: defcon
- platform: partition
name: "DEFCON1"
segments:
- id: defcon
from: 0
to: 0
- platform: partition
name: "DEFCON2"
segments:
- id: defcon
from: 1
to: 1
- platform: partition
name: "DEFCON3"
segments:
- id: defcon
from: 2
to: 2
- platform: partition
name: "DEFCON4"
segments:
- id: defcon
from: 3
to: 3
- platform: partition
name: "DEFCON5"
segments:
- id: defcon
from: 4
to: 4
#ALPHA DISPLAY
i2c:
sda: 21
scl: 22
text_sensor:
- platform: template
name: "WOPR_DISPLAY"
id: wopr_display
entity_category: ''
lambda: |-
if(id(wopr_display).state == ""){
return {"!TIME"};
}else{
return {id(wopr_display).state};
}
number:
- platform: template
id: text_timeout
name: WOPR Message Timeout
max_value: 600
min_value: 10
step: 1
restore_value: true
initial_value: 10
unit_of_measurement: s
optimistic: true
entity_category: config
script:
- id: restore_clock
mode: restart
then:
- delay: !lambda 'return id(text_timeout).state * 1000;'
- text_sensor.template.publish:
id: wopr_display
state: '!TIME'
display:
- platform: ht16k33_alpha
address: 0x70
scroll: true
scroll_speed: 250ms
scroll_dwell: 2s
scroll_delay: 3
lambda: |-
if(id(wopr_display).state != "!TIME"){
it.print(id(wopr_display).state);
}else{
it.strftime(" %H %M %S", id(my_time).now());
}
secondary_displays:
- address: 0x72
- address: 0x74