forked from bcongdon/aqi-esphome
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathairgradient.yaml
156 lines (139 loc) · 3.06 KB
/
airgradient.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
esphome:
name: airgradient
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: ""
wifi:
ssid: ""
password: ""
manual_ip:
static_ip:
gateway:
subnet:
# Enable falback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ""
password: ""
captive_portal:
animation:
- file: "images/HAPPYFACE.gif"
id: happy
type: GRAYSCALE
- file: "images/MODERATEFACE.gif"
id: moderate
type: GRAYSCALE
- file: "images/MIFFEDFACE.gif"
id: miffed
type: GRAYSCALE
- file: "images/UNHEALTHYFACE.gif"
id: unhealthy
type: GRAYSCALE
- file: "images/VUNHEALTHYFACE.gif"
id: vunhealthy
type: GRAYSCALE
- file: "images/HAZARDOUSFACE.gif"
id: hazardous
type: GRAYSCALE
i2c:
sda: D2
scl: D1
frequency: 800kHz
# spi:
# clk_pin: D0
# mosi_pin: D1
display:
- platform: ssd1306_i2c
id: oled
model: "SSD1306 64x48"
reset_pin: D0
rotation: 90
brightness: 50%
pages:
- id: page1
lambda: |-
it.image(0, 0, id(happy));
- id: page2
lambda: |-
it.image(0, 0, id(moderate));
- id: page3
lambda: |-
it.image(0, 0, id(miffed));
- id: page4
lambda: |-
it.image(0, 0, id(unhealthy));
- id: page5
lambda: |-
it.image(0, 0, id(vunhealthy));
- id: page6
lambda: |-
it.image(0, 0, id(hazardous));
interval:
- interval: 5s
then:
display.page.show:
!lambda |-
if (id(pm25).state < 12) {
return id(page1);
} else if (id(pm25).state < 35) {
return id(page2);
} else if (id(pm25).state < 55) {
return id(page3);
} else if (id(pm25).state < 150) {
return id(page4);
} else if (id(pm25).state < 250) {
return id(page5);
} else {
return id(page6);
}
- interval: 1s
then:
lambda: |-
if (id(pm25).state < 12) {
id(happy).next_frame();
} else if (id(pm25).state < 35) {
id(moderate).next_frame();
} else if (id(pm25).state < 55) {
id(miffed).next_frame();
} else if (id(pm25).state < 150) {
id(unhealthy).next_frame();
} else if (id(pm25).state < 250) {
id(vunhealthy).next_frame();
} else {
id(hazardous).next_frame();
}
uart:
- rx_pin: D5
tx_pin: D6
baud_rate: 9600
id: uart1
- rx_pin: D4
tx_pin: D3
baud_rate: 9600
id: uart2
sensor:
- platform: sht3xd
temperature:
id: temperature
name: "Temperature"
humidity:
id: humidity
name: "Humidity"
address: 0x44
update_interval: 60s
- platform: pmsx003
type: PMS5003T
uart_id: uart1
pm_2_5:
id: pm25
name: "Particulate Matter <2.5µm Concentration"
- platform: senseair
uart_id: uart2
co2:
id: co2
name: "SenseAir CO2 Value"
update_interval: 60s