esphome:
name: airgradient
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "🐺 and 🐲"
password: "*******************"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Airgradient Fallback Hotspot"
password: "*******************"
captive_portal:
i2c:
sda: D2
scl: D1
font:
- file: "gfonts://Roboto"
id: opensans
size: 20
- file: "gfonts://Open+Sans@300"
id: opensans10
size: 10
- file: 'materialdesignicons-webfont.ttf'
id: icon_font
size: 20
glyphs:
- "\U000F050F" # mdi-thermometer
- "\U000F058E" # mdi-water-percent
- "\U000F0438" # mdi-radiator
- "\U000F07E4" # mdi-molecule-co2
- "\U000F03E3" # mdi-parking
display:
- platform: ssd1306_i2c
id: oled
model: "SSD1306 64x48"
pages:
- id: page1
lambda: |-
it.printf(0, 0, id(icon_font), "\U000F050F");
it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f°C", id(temp).state);
it.printf(0, 20, id(icon_font), "\U000F058E");
it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%0.0f%% ", id(humidity).state);
- id: page2
lambda: |-
it.printf(0, 0, id(icon_font), "\U000F0438");
it.printf(20, 7, id(opensans10), "v");
it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(voc).state);
it.printf(0, 20, id(icon_font), "\U000F0438");
it.printf(20, 27, id(opensans10), "n");
it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(nox).state);
- id: page3
lambda: |-
it.printf(0, 0, id(icon_font), "\U000F07E4");
it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(co2).state);
it.printf(0, 20, id(icon_font), "\U000F03E3");
it.printf(10, 29, id(opensans10), "10");
it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm1).state);
- id: page4
lambda: |-
it.printf(0, 0, id(icon_font), "\U000F03E3");
it.printf(10, 9, id(opensans10), "25");
it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm25).state);
it.printf(0, 20, id(icon_font), "\U000F03E3");
it.printf(10, 29, id(opensans10), "100");
it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm10).state);
# if (id(pm25).has_state()) {
# it.printf(0, 10, id(opensans), "PM25:");
# it.printf(it.get_width(), 10, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(pm25).state);
# }
# Maybe add a page later
interval:
- interval: 2s
then:
- display.page.show_next: oled
- component.update: oled
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: pm1
pm_2_5:
name: "Particulate Matter <2.5µm Concentration"
id: pm25
pm_10_0:
name: "Particulate Matter <10.0µm Concentration"
id: pm10
- platform: senseair
uart_id: uart2
co2:
id: co2
name: "SenseAir CO2 Value"
update_interval: 60s
- platform: sgp4x
voc:
id: voc
name: "VOC Index"
nox:
id: nox
name: "NOx Index"
compensation:
temperature_source: temp
humidity_source: humidity