-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm5stickcplusTest.yaml
176 lines (160 loc) · 4.32 KB
/
m5stickcplusTest.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
esphome:
name: m5stickcplus
esp32:
board: m5stick-c
framework:
type: arduino
ota:
api:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
id: wifi_id
ap:
ssid: "${friendly_name} Fallback"
password: !secret wifi_fallback_password
external_components:
# - source: github://pr#5214 # used to load images on compile
# components: [ image ]
# refresh: 0s
- source: github://pr#5254 # used to load images on compile
refresh: 0s
components: [ font ]
# - source:
# type: git
# url: https://github.com/esphome/esphome
# ref: dev
# components: [adc, i2s_audio, microphone]
# - source:
# type: git
# url: https://gitlab.com/geiseri/esphome_extras.git
# refresh: 0s
# components: [axp192]
# - source: github://paulchilton/esphome-axp192
# components: [axp192]
# refresh: 0s
- source:
type: git
url: https://github.com/landonr/esphome-axp192
ref: lando/add-charging-indicator
# type: local
# path: ../axp192/components
- source:
type: git
url: https://github.com/landonr/homeThing
ref: main
# type: local
# path: ../homeThing/components
refresh: 0s
components: [homeThing]
- source:
type: git
url: https://github.com/landonr/esphome-components
ref: main
# type: local
# path: ../local_components/components
refresh: 0s
components: [
homeassistant_component,
homeassistant_media_player,
media_player_source,
media_player_source_sonos,
media_player_source_spotify,
media_player_source_custom,
MiniEncoderC
]
logger:
level: DEBUG
packages:
remote_package:
url: https://github.com/landonr/homeThing
ref: main
files: [
common/fonts.yaml, # default font
common/icon_fonts.yaml, # material icons
common/m5stack-stickc/axp192-marty.yaml, # power management and screen backlight
# common/m5stack-stickc/binary_sensor.yaml, # buttons
# common/m5stack-stickc/MiniEncoderC.yaml, # rotary encoder and built in led
]
refresh: 0s
# fonts: !include ../homeThing/common/fonts.yaml
# icon_fonts: !include ../homeThing/common/icon_fonts.yaml
# images: !include ../homeThing/common/images.yaml
# axp192: !include ../homeThing/common/m5stack-stickc/axp192-marty.yaml # power management and screen backlight
# binary_sensor: !include ../homeThing/common/m5stack-stickc/binary_sensor.yaml # buttons
# mini_encoder_c: !include ../homeThing/common/m5stack-stickc/MiniEncoderC.yaml # rotary encoder and built in led
substitutions:
friendly_name: "homeThingM5StickPlus"
binary_sensor:
- platform: gpio
pin:
number: GPIO37
inverted: true
name: Button A
on_press:
then:
switch.toggle: restart_switch
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
backlight_pin: no
rotation: 270
update_interval: 1s
lambda: |-
if (id(axp_charger).state) {
it.rectangle(10, 10, 108, 44, Color(0, 255, 0));
it.printf(60, 25, id(small_font), "Charging");
} else {
it.rectangle(10, 10, 108, 44, Color(255, 0, 0));
it.printf(60, 25, id(small_font), "Not Charging");
}
it.printf(20, 50, id(small_font), "Battery: %f", id(batteryPercent).state);
if (!id(ads1115_hub).is_failed()) {
it.printf(20, 70, id(small_font), "Voltage!!! %f", id(ads1115_a0_gnd).state);
} else {
it.printf(20, 70, id(small_font), "Voltage: N/A");
}
return;
# Individual outputs
switch:
# - platform: gpio
# name: "PCF8574 Pin #0"
# id: ledpin
# pin:
# pcf8574: pcf8574_hub
# number: 3
# mode:
# output: true
# inverted: True
- platform: restart
id: restart_switch
name: "${friendly_name} Restart"
i2c:
- id: bus_c
sda: GPIO32
scl: GPIO33
scan: true
ads1115:
- address: 0x48
i2c_id: bus_c
id: ads1115_hub
sensor:
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
id: ads1115_a0_gnd
update_interval: 0.5s
unit_of_measurement: "%"
name: "ADS1115 Channel A0-GND"
filters:
calibrate_linear:
- 0.0 -> 0.0
- 5.0 -> 100.0