/
esphome.yaml
155 lines (139 loc) · 3.09 KB
/
esphome.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
esphome:
name: bedside-lights #Update me
friendly_name: bedside-lights #Update me
includes:
- touch_panel.hpp
- touch_panel.cpp
esp32:
board: esp32dev
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: your_key_here
ota:
password: your_password_here
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
uart:
id: uart_bus
tx_pin: 19
rx_pin: 22
baud_rate: 115200
binary_sensor:
- platform: custom
lambda: |-
auto touch_panel = new touch_panel::TouchPanel(id(uart_bus));
App.register_component(touch_panel);
return {
touch_panel->left,
touch_panel->right,
touch_panel->middle,
touch_panel->two_finger,
touch_panel->dragged_ltr,
touch_panel->dragged_rtl,
};
binary_sensors:
- id: button_left
name: "Left Button"
on_press:
- switch.toggle: relay1
- switch.turn_on: haptics
- id: button_right
name: "Right Button"
on_press:
- switch.toggle: relay2
- switch.turn_on: haptics
# Switch Relays
switch:
- platform: gpio
name: "Left Bedside light"
pin: GPIO18
id: relay1
restore_mode: ALWAYS_OFF
on_turn_on:
then:
light.turn_on: status_light_left
on_turn_off:
then:
light.turn_off: status_light_left
- platform: gpio
name: "Right Bedside light"
pin: GPIO17
restore_mode: ALWAYS_OFF
id: relay2
on_turn_on:
then:
light.turn_on: status_light_right
on_turn_off:
then:
light.turn_off: status_light_right
- platform: gpio
name: "touch panel power"
pin:
number: GPIO5
inverted: true
id: ca51_pow
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin: GPIO21
name: "Haptics"
id: "haptics"
restore_mode: ALWAYS_OFF
on_turn_on:
- delay: 60ms
- switch.turn_off: haptics
# Light
light:
- platform: neopixelbus
type: GRB
variant: WS2812
pin: GPIO13
num_leds: 1
name: "NeoPixel 13"
internal: true
- platform: neopixelbus
type: GRB
variant: WS2812
pin: GPIO13
num_leds: 28
name: "Nightlight"
id: rgb_light
effects:
- addressable_rainbow:
name: 'rainbow fast'
speed: 50
- addressable_twinkle:
- platform: partition
id: status_light_right
name: "Status LED - right"
segments:
- id: rgb_light
from: 6 #0
to: 6
on_turn_on:
then:
light.turn_on:
id: status_light_right
brightness: 90%
red: 100%
green: 80%
blue: 50%
- platform: partition
id: status_light_left
name: "Status LED - left"
segments:
- id: rgb_light
from: 12 #12
to: 12
on_turn_on:
then:
light.turn_on:
id: status_light_left
brightness: 90%
red: 100%
green: 80%
blue: 50%