-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
air-gradient-diy.yaml
130 lines (111 loc) · 2.97 KB
/
air-gradient-diy.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
esphome:
name: air-gradient
platform: ESP8266
board: d1_mini_pro
project:
name: ajfriesen.ESPHome-AirGradient
version: "1.0"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret ota_password
# Create a switch for safe_mode in order to flash the device
# Solution from this thread:
# https://community.home-assistant.io/t/esphome-flashing-over-wifi-does-not-work/357352/1
switch:
- platform: safe_mode
name: "Flash Mode (Safe Mode)"
button:
- platform: template
name: "Flash mode"
id: flash_button
icon: "mdi:cellphone-arrow-down"
on_press:
then:
- switch.toggle: safe_mode
dashboard_import:
# package_import_url: github://esphome/esphome-project-template/project-template-esp32.yaml@v6
package_import_url: github://ajfriesen/ESPHome-AirGradient/main/air-gradient.yaml
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 15min
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Air-Gradient Fallback Hotspot"
password: !secret fallback_ssid_password
captive_portal:
i2c:
sda: D2
scl: D1
font:
- file: "font/monofont.ttf"
id: opensans
size: 10
display:
- platform: ssd1306_i2c
id: oled
model: "SSD1306 64x48"
pages:
- id: page1
lambda: |-
it.printf(0, 0, id(opensans), "CO2: %.0fppm", id(co2).state);
it.printf(0, 10, id(opensans), "PM25: %.0f", id(pm25).state);
it.printf(0, 20, id(opensans), "Hmdty: %.0f", id(humidity).state);
it.printf(0, 30, id(opensans), "Temp: %.0fC", id(temp).state);
# - id: page2
# lambda: |-
# it.printf(0, 0, id(opensans), "PM10 : %.0f", id(pm10).state);
# it.printf(0, 10, id(opensans), "PM25 : %.0f", id(pm25).state);
# it.printf(0, 20, id(opensans), "PM100: %.0f", id(pm100).state);
# Maybe add a page later
interval:
- interval: 5s
then:
- display.page.show_next: oled
- component.update: oled
uart:
- rx_pin: D5
tx_pin: D6
baud_rate: 9600
id: uart_1
- rx_pin: D4
tx_pin: D3
baud_rate: 9600
id: uart_2
sensor:
- platform: sht3xd
temperature:
id: temp
name: "Temperature"
humidity:
id: humidity
name: "Humidity"
address: 0x44
update_interval: 5s
- platform: pmsx003
# type can be PMSX003, PMS5003S, PMS5003T, PMS5003ST
# https://esphome.io/components/sensor/pmsx003.html
type: PMSX003
uart_id: uart_1
# pm_1_0:
# id: pm10
# name: "Particulate Matter <1.0µm Concentration"
pm_2_5:
id: pm25
name: "Particulate Matter <2.5µm Concentration"
# pm_10_0:
# id: pm100
# name: "Particulate Matter <10.0µm Concentration"
# formaldehyde:
# id: hcho
# name: "Formaldehyde (HCHO) concentration in µg per cubic meter"
- platform: senseair
uart_id: uart_2
co2:
id: co2
name: "SenseAir CO2 Value"
update_interval: 60s