forked from landonr/homeThing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
m5stickcplus.yaml
executable file
·202 lines (187 loc) · 4.29 KB
/
m5stickcplus.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
esphome:
name: m5stickc
includes:
- esphomeRemote/MenuGlobals.h
- esphomeRemote/MenuTitle.h
- esphomeRemote/FriendlyNameEntity.h
- esphomeRemote/TextHelpers.h
- esphomeRemote/esphomeRemotePlayer.h
- esphomeRemote/esphomeRemoteService.h
- esphomeRemote/esphomeRemoteLight.h
- esphomeRemote/esphomeRemoteSwitch.h
- esphomeRemote/esphomeRemoteSensor.h
- esphomeRemote/DisplayUpdateInterface.h
- esphomeRemote/esphomeRemote.h
- esphomeRemote/esphomeRemoteNowPlayingMenu.h
- esphomeRemote/esphomeRemote2Button.h
esp32:
board: m5stick-c
framework:
type: arduino
substitutions:
boot_name: '"M5Stick Remote <3"'
friendly_name: M5stickcRemote
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
wifi_fallback_password: !secret wifi_fallback_password
large_font_size: "20"
medium_font_size: "14"
small_font_size: "12"
icon_size: "18"
icon_size_large: "19"
header_height: "16"
margin_size: "4"
scroll_bar_width: "6"
bottom_bar_margin: "32"
now_playing_max_lines: "8"
draw_now_playing_menu: "true"
draw_battery_level: "true"
draw_volume_level: "false"
draw_shuffle_disabled: "false"
draw_header_time: "false"
color_accent_primary_red: 63%
color_accent_primary_green: 13%
color_accent_primary_blue: 94%
display_timeout: "16"
sleep_after: "7200"
menu_rollover_on: "false"
sync_active_player: "true"
dark_mode: "true"
<<: !include esphomeRemote/sharedRemoteConfig.yaml
i2c:
- id: bus_a
sda: GPIO21
scl: GPIO22
scan: true
external_components:
- source:
type: git
url: https://gitlab.com/geiseri/esphome_extras.git
refresh: 0s
components: [axp192]
axp192:
id: axp
address: 0x34
i2c_id: bus_a
update_interval: 60s
sensor:
# AXP192 power management - must be present to initialize TFT power on
- platform: axp192
axp192_id: axp
id: batteryPercent
- platform: template
id: display_update_tick
filters:
- debounce: 0.02s
on_value :
then:
- lambda: |-
if(idleTime < 2) {
displayUpdate.updateDisplay(true);
}
# internal LED
light:
- platform: monochromatic
output: builtin_led
name: Led
id: led1
- platform: axp192
id: axpbacklight
axp192_id: axp
restore_mode: ALWAYS_ON
name: Backlight
output:
- platform: ledc
pin: 10
inverted: true
id: builtin_led
binary_sensor:
- platform: axp192
axp192_id: axp
type: charging
id: axp_charger
name: Charger
on_state:
then:
lambda: |-
charging = x;
- platform: gpio
pin:
number: GPIO37
inverted: true
name: Button A
on_press:
then:
lambda: |-
buttonPressRight();
auto call = id(led1).turn_on();
call.set_transition_length(0);
call.perform();
on_release:
then:
- light.turn_off: led1
- platform: gpio
pin:
number: GPIO39
inverted: true
name: Button B
on_press:
then:
lambda: |-
buttonPressSelect();
auto call = id(led1).turn_on();
call.set_transition_length(0);
call.perform();
on_release:
then:
- light.turn_off: led1
deep_sleep:
id: deep_sleep_m5
wakeup_pin: 37
wakeup_pin_mode: INVERT_WAKEUP
switch:
- platform: template
id: sleep_toggle
internal: true
optimistic: true
on_turn_on:
then:
- light.turn_off:
id: axpbacklight
transition_length: 0s
- delay: 0.5s
- deep_sleep.enter:
id: deep_sleep_m5
- platform: template
id: backlight
optimistic: true
internal: true
on_turn_on:
then:
- light.turn_on:
id: axpbacklight
on_turn_off:
then:
- light.turn_off:
id: axpbacklight
transition_length: 0.5s
spi:
clk_pin: GPIO13
mosi_pin: GPIO15
display:
- platform: st7789v
model: TTGO_TDisplay_135x240
id: my_display
cs_pin: GPIO5
dc_pin: GPIO23
reset_pin: GPIO18
rotation: 0
update_interval: 60s
lambda: |-
if (idleTime < 0) {
ESP_LOGD("drawing menu", "turning on");
id(backlight).turn_on();
idleTime = 0;
}
drawMenu();
return;