-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathadvanced-example.yaml
355 lines (332 loc) · 9.71 KB
/
advanced-example.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# Advanced configuration example
# This includes some commented out configuration items showing what other functionality is available
# Available icons can be found in 'components\nspanel_lovelace\icons.json'. Icon colors range from 0 to 65535.
# NOTE: This project is in the beta stage so the configuration is subject to change without notice.
# Please check your own configuration againist the latest example when updating.
esphome:
name: nspanel
name_add_mac_suffix: true
comment: "ESPHome Advanced NSPanel Example"
build_path: ./.build/nspanel-advanced
esp32:
board: esp32dev
framework:
# ESP-IDF is requried so we can access the NSPanel PSRAM
# which is on non-standard pins. ESP-IDF also uses less flash than Arduino!
type: esp-idf
external_components:
- source:
type: git
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: dev
refresh: 3h
components: [nspanel_lovelace]
nspanel_lovelace:
id: nspanel
sleep_timeout: 10
# locale:
## This can be the ISO 639‑1 language code or a custom json file (i.e. custom.json).
## Currently supported languages:
## - English/English (GB): en.json, en-GB.json
## - Czech/Čeština: cs.json
## - German/Deutsch: de.json
## - Greek/Νέα Ελληνικά: el.json
## - Spanish/Español: es.json
## NOTE: This feature is in beta so the translation keys and values could change at any time!
## Any custom translation files you create will need to be kept in sync with the the files on the repo
## https://github.com/olicooper/esphome-nspanel-lovelace-native/tree/dev/components/nspanel_lovelace/translations
# language: en
# temperature_unit: celcius
screensaver:
time_id: homeassistant_time
## For formatting options see: https://cplusplus.com/reference/ctime/strftime/
# time_format: '%H:%M'
# date_format: '%A, %d. %B %Y'
weather:
entity_id: !secret weather_entity_id
## NOTE: use this version (after following the instructions on the README) with Home Assistant v4.4.0+
# entity_id: sensor.weather_forecast_daily
# status_icon_left:
# entity_id: light.front_room_inner
# icon: hiking
# status_icon_right:
# entity_id: light.front_room_outer
# icon:
# value: robot-outline
# color: 200
cards:
- type: cardGrid
id: front_room
title: Front Room
sleep_timeout: 10
# hidden: true
entities:
- entity_id: light.front_room_all
name: All
- entity_id: light.front_room_inner
name: Inner
- entity_id: light.front_room_outer
name: Outer
- entity_id: scene.front_room_all_default
name: Default
- type: cardGrid
sleep_timeout: 10
title: House Lights
entities:
- entity_id: light.hallway
name: Hallway
- entity_id: light.stairs
name: Stairs
- entity_id: delete
- entity_id: delete
- entity_id: switch.garden_lights
name: Garden
- type: cardEntities
sleep_timeout: 30
title: House Info
entities:
- entity_id: sensor.outside_temperature
name: Outside Temp
- entity_id: sensor.nspanel_temperature
name: Room Temp
- entity_id: navigate.front_room
name: Front Room Nav
- type: cardQR
sleep_timeout: 30
title: Guest WiFi
qr_text: !secret qrcard_text
entities:
- entity_id: !secret qrcard_ssid_itext
name: SSID
icon: wifi
- entity_id: !secret qrcard_password_itext
name: Password
icon: key
- type: cardAlarm
sleep_timeout: 60
title: Home Alarm
alarm_entity_id: alarm_control_panel.home_alarm
- type: cardThermo
sleep_timeout: 60
title: Thermo Ecobee
thermo_entity_id: climate.ecobee
# temperature_unit: fahrenheit
logger:
baud_rate: 115200
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
services:
## Service to update the TFT firmware using a URL that is accessible to the nspanel
- service: upload_tft
variables:
url: string
then:
- lambda: 'id(nspanel).upload_tft(url);'
## Service to display a notification on the screensaver
- service: notify_on_screensaver
variables:
heading: string
message: string
## Set to 0 (or remove) to keep message until screensaver refreshes
timeout_ms: int
then:
- lambda: 'id(nspanel).notify_on_screensaver(heading, message, timeout_ms);'
- rtttl.play: 'scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b'
## Service to send a command directly to the display (useful for testing)
# - service: send_command
# variables:
# cmd: string
# then:
# - lambda: 'id(nspanel).send_display_command(cmd);'
ota:
platform: esphome
password: !secret ota_password
## UART for the Nextion display
uart:
id: uart_nextion
tx_pin: 16
rx_pin: 17
baud_rate: 115200
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/London
on_time:
## At midnight
- seconds: 0
minutes: 0
hours: 0
then:
- lambda: 'id(nspanel).set_display_dim(1, 50);'
## At 8:00 PM
- seconds: 0
minutes: 0
hours: 20
then:
- lambda: 'id(nspanel).set_display_dim(20, 80);'
## At 7:00 AM
- seconds: 0
minutes: 0
hours: 7
then:
- lambda: 'id(nspanel).set_display_dim(50, 100);'
switch:
## Physical relay 1
- platform: gpio
name: Relay 1
id: relay_1
pin:
number: 19
restore_mode: ALWAYS_ON
## Physical relay 2
- platform: gpio
name: Relay 2
id: relay_2
pin:
number: 22
restore_mode: ALWAYS_ON
## Turn screen power on/off
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
sensor:
## WiFi signal strength sensor
- platform: wifi_signal
name: WiFi Signal
update_interval: 300s
## Internal temperature sensor, adc value
- platform: adc
id: ntc_source
pin: 38
update_interval: 60s
attenuation: 12db
## Internal temperature sensor, adc reading converted to resistance (calculation)
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
## Internal temperature sensor, resistance to temperature (calculation)
- platform: ntc
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: Temperature
binary_sensor:
## Left button below the display
- platform: gpio
name: Left Button
pin:
number: GPIO14
inverted: true
id: left_button
internal: true
on_multi_click:
####### Single click - toggle front_room_inner
- timing:
- ON for at most 1s
- OFF for at least 0.4s
then:
- if:
condition:
api.connected:
then:
- if:
condition:
switch.is_off: relay_1
then:
- switch.turn_on: relay_1
else:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.front_room_inner
else:
- switch.toggle: relay_1
####### Triple click - restart the ESP32
- timing:
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at least 0.3s
then:
- button.press: restart_switch
####### Single long click - toggle light relay 1
- timing:
- ON for 1.2s to 4s
- OFF for at least 0.3s
then:
- switch.toggle: relay_1
## Right button below the display
- platform: gpio
name: Right Button
pin:
number: GPIO27
inverted: true
id: right_button
internal: true
on_multi_click:
####### Single click - toggle light front_room_outer
- timing:
- ON for at most 1s
- OFF for at least 0.4s
then:
- if:
condition:
api.connected:
then:
- if:
condition:
switch.is_off: relay_2
then:
- switch.turn_on: relay_2
else:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.front_room_outer
else:
- switch.toggle: relay_2
####### Triple click - restart TFT
- timing:
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at least 0.3s
then:
- switch.turn_off: screen_power
- delay: 0.5s
- switch.turn_on: screen_power
####### Single long click - toggle light relay 2
- timing:
- ON for 1.2s to 4s
- OFF for at least 0.4s
then:
- switch.toggle: relay_2
button:
- platform: restart
id: restart_switch
name: Restart
output:
## Buzzer for playing tones
- platform: ledc
id: buzzer_out
pin: 21
## Rtttl function for buzzer
rtttl:
id: buzzer
output: buzzer_out