Example ESPHome configure for a AirGradient Pro DIY kit. Nice-looking display pages included. I used product sans, roboto, and material design icons, feel free to swap out the fonts. Smoothing particulate readings because they tended to fluctuate from second to second.
Last active
July 19, 2023 18:43
-
-
Save halomakes/f301822bcbf053783bb04f902c74865a to your computer and use it in GitHub Desktop.
AirGradient Pro ESPHome Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: airgradient | |
platform: ESP8266 | |
board: d1_mini | |
# Enable logging | |
logger: | |
wifi: | |
networks: | |
- ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
reboot_timeout: 15min | |
switch: | |
- platform: safe_mode | |
name: "Flash Mode (Safe Mode)" | |
# Enable Home Assistant API | |
api: | |
ota: | |
captive_portal: | |
i2c: | |
sda: D2 | |
scl: D1 | |
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: temp | |
name: "Temperature" | |
humidity: | |
id: humidity | |
name: "Humidity" | |
address: 0x44 | |
update_interval: 5s | |
- platform: pmsx003 | |
type: PMSX003 | |
uart_id: uart1 | |
pm_1_0: | |
name: "Particulate Matter <1.0µm Concentration" | |
id: pm10 | |
filters: | |
- sliding_window_moving_average: | |
window_size: 5 | |
send_every: 5 | |
pm_2_5: | |
name: "Particulate Matter <2.5µm Concentration" | |
id: pm25 | |
filters: | |
- sliding_window_moving_average: | |
window_size: 5 | |
send_every: 5 | |
pm_10_0: | |
name: "Particulate Matter <10.0µm Concentration" | |
id: pm100 | |
filters: | |
- sliding_window_moving_average: | |
window_size: 5 | |
send_every: 5 | |
- platform: senseair | |
uart_id: uart2 | |
co2: | |
id: co2 | |
name: "SenseAir CO2 Value" | |
update_interval: 20s | |
font: | |
- file: "font/productsans.ttf" | |
id: product | |
size: 42 | |
glyphs: | | |
0123456789 . | |
- file: "font/Roboto-Light.ttf" | |
id: unit | |
size: 16 | |
glyphs: | | |
!"%°RHF pmgµ³/ | |
- file: "font/Roboto-Light.ttf" | |
id: label | |
size: 11 | |
glyphs: | | |
HTPCD abcdeilmnoprstuxy | |
- file: "font/materialdesignicons.ttf" | |
id: icon | |
size: 38 | |
glyphs: [ | |
"", #CO2 | |
"", #home thermometer outline | |
"", #water percent | |
"", #smoke | |
] | |
display: | |
- platform: ssd1306_i2c | |
model: "SH1106 128x64" | |
rotation: "180°" | |
id: main_screen | |
pages: | |
- id: page1 | |
lambda: |- | |
it.printf(84, 72, id(product), TextAlign::BOTTOM_RIGHT, "%.1f", (id(temp).state * 1.8) + 32); | |
it.printf(84, 64, id(unit), TextAlign::BOTTOM_LEFT, "°F"); | |
it.printf(128, 0, id(icon), TextAlign::TOP_RIGHT, ""); | |
it.printf(86, 12, id(label), TextAlign::TOP_RIGHT, "Temperature"); | |
- id: page2 | |
lambda: |- | |
it.printf(84, 72, id(product), TextAlign::BOTTOM_RIGHT, "%.1f", id(humidity).state); | |
it.printf(84, 64, id(unit), TextAlign::BOTTOM_LEFT, "%% RH"); | |
it.printf(128, 0, id(icon), TextAlign::TOP_RIGHT, ""); | |
it.printf(86, 12, id(label), TextAlign::TOP_RIGHT, "Humidity"); | |
- id: page3 | |
lambda: |- | |
it.printf(84, 72, id(product), TextAlign::BOTTOM_RIGHT, "%.0f", id(co2).state); | |
it.printf(84, 64, id(unit), TextAlign::BOTTOM_LEFT, "ppm"); | |
it.printf(128, 0, id(icon), TextAlign::TOP_RIGHT, ""); | |
it.printf(86, 12, id(label), TextAlign::TOP_RIGHT, "Carbon Dioxide"); | |
- id: page4 | |
lambda: |- | |
it.printf(84, 72, id(product), TextAlign::BOTTOM_RIGHT, "%.0f", id(pm25).state); | |
it.printf(84, 64, id(unit), TextAlign::BOTTOM_LEFT, "µg/m³"); | |
it.printf(128, 0, id(icon), TextAlign::TOP_RIGHT, ""); | |
it.printf(86, 12, id(label), TextAlign::TOP_RIGHT, "Particulates"); | |
interval: | |
- interval: 8s | |
then: | |
- display.page.show_next: main_screen | |
- component.update: main_screen |
This was really useful. Thank you for posting it. I combined your nice display with the 'standard' home assistant template from ajfriesen and it integrates and looks amazing!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing your file @halomademeapc
Here are some suggestions / fixes / tips for other people:
uart1
/uart2
touart_1
anduart_2
, since these became disallowed ids in ESPHomerotation
from"180°"
to"0°"