New Paste

 

Recent Pastes

Administrate




Pastebin on paste.luisaranguren.com

PasteID: m9
Pasted by Anonymous, 2024-11-06 05:20:28 GMT
Expires Never
Paste size 4.03 Kb
Tools Raw   Download
 
  1. esphome:  
  2.   name: airgradient  
  3.   
  4. esp8266:  
  5.   board: d1_mini  
  6.   
  7. # Enable logging  
  8. logger:  
  9.   
  10. # Enable Home Assistant API  
  11. api:  
  12.   password: ""  
  13.   
  14. ota:  
  15.   password: ""  
  16.   
  17. wifi:  
  18.   ssid: "🐺 and 🐲"  
  19.   password: "*******************"  
  20.   
  21.   # Enable fallback hotspot (captive portal) in case wifi connection fails  
  22.   ap:  
  23.     ssid: "Airgradient Fallback Hotspot"  
  24.     password: "*******************"  
  25.   
  26. captive_portal:  
  27.       
  28. i2c:  
  29.   sda: D2  
  30.   scl: D1  
  31.   
  32. font:  
  33.   - file: "gfonts://Roboto"  
  34.     id: opensans  
  35.     size: 20  
  36.   - file: "gfonts://Open+Sans@300"  
  37.     id: opensans10  
  38.     size: 10  
  39.   - file: 'materialdesignicons-webfont.ttf'  
  40.     id: icon_font  
  41.     size: 20  
  42.     glyphs:  
  43.       - "\U000F050F" # mdi-thermometer  
  44.       - "\U000F058E" # mdi-water-percent  
  45.       - "\U000F0438" # mdi-radiator  
  46.       - "\U000F07E4" # mdi-molecule-co2  
  47.       - "\U000F03E3" # mdi-parking  
  48. display:  
  49.   - platform: ssd1306_i2c  
  50.     id: oled  
  51.     model: "SSD1306 64x48"  
  52.     pages:  
  53.       - id: page1  
  54.         lambda: |-  
  55.           it.printf(0, 0, id(icon_font), "\U000F050F");  
  56.           it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f°C", id(temp).state);  
  57.           it.printf(0, 20, id(icon_font), "\U000F058E");  
  58.           it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%0.0f%% ", id(humidity).state);  
  59.       - id: page2  
  60.         lambda: |-  
  61.           it.printf(0, 0, id(icon_font), "\U000F0438");  
  62.           it.printf(20, 7, id(opensans10), "v");  
  63.           it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(voc).state);  
  64.           it.printf(0, 20, id(icon_font), "\U000F0438");  
  65.           it.printf(20, 27, id(opensans10), "n");  
  66.           it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(nox).state);  
  67.       - id: page3  
  68.         lambda: |-  
  69.           it.printf(0, 0, id(icon_font), "\U000F07E4");  
  70.           it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(co2).state);  
  71.           it.printf(0, 20, id(icon_font), "\U000F03E3");  
  72.           it.printf(10, 29, id(opensans10), "10");  
  73.           it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm1).state);  
  74.       - id: page4  
  75.         lambda: |-  
  76.           it.printf(0, 0, id(icon_font), "\U000F03E3");  
  77.           it.printf(10, 9, id(opensans10), "25");  
  78.           it.printf(it.get_width(), 0, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm25).state);  
  79.           it.printf(0, 20, id(icon_font), "\U000F03E3");  
  80.           it.printf(10, 29, id(opensans10), "100");  
  81.           it.printf(it.get_width(), 20, id(opensans), TextAlign::TOP_RIGHT, "%.0f", id(pm10).state);  
  82.   
  83. #          if (id(pm25).has_state()) {  
  84. #            it.printf(0, 10, id(opensans), "PM25:");  
  85. #            it.printf(it.get_width(), 10, id(opensans), TextAlign::TOP_RIGHT, "%0.0f", id(pm25).state);  
  86. #          }  
  87. # Maybe add a page later  
  88.   
  89. interval:  
  90.   - interval: 2s  
  91.     then:  
  92.       - display.page.show_next: oled  
  93.       - component.update: oled  
  94.   
  95. uart:  
  96.   - rx_pin: D5  
  97.     tx_pin: D6  
  98.     baud_rate: 9600  
  99.     id: uart1  
  100.       
  101.   - rx_pin: D4  
  102.     tx_pin: D3  
  103.     baud_rate: 9600  
  104.     id: uart2  
  105.   
  106. sensor:  
  107.   - platform: sht3xd  
  108.     temperature:  
  109.       id: temp  
  110.       name: "Temperature"  
  111.     humidity:  
  112.       id: humidity  
  113.       name: "Humidity"  
  114.     address: 0x44  
  115.     update_interval: 5s  
  116.   
  117.   - platform: pmsx003  
  118.     type: PMSX003  
  119.     uart_id: uart1  
  120.     pm_1_0:  
  121.       name: "Particulate Matter <1.0µm Concentration"  
  122.       id: pm1  
  123.     pm_2_5:  
  124.       name: "Particulate Matter <2.5µm Concentration"  
  125.       id: pm25  
  126.     pm_10_0:  
  127.       name: "Particulate Matter <10.0µm Concentration"  
  128.       id: pm10  
  129.   
  130.   - platform: senseair  
  131.     uart_id: uart2  
  132.     co2:  
  133.       id: co2  
  134.       name: "SenseAir CO2 Value"  
  135.     update_interval: 60s  
  136.   
  137.   - platform: sgp4x  
  138.     voc:  
  139.       id: voc  
  140.       name: "VOC Index"  
  141.     nox:  
  142.       id: nox  
  143.       name: "NOx Index"  
  144.     compensation:  
  145.       temperature_source: temp  
  146.       humidity_source: humidity  
  147.  

 
 

 
 
 
 
 
Written by Xan Manning, 2010.