changeset 20:ec7e7d2c763f

aq sync and refactors; start hw.md
author drewp@bigasterisk.com
date Tue, 13 Aug 2024 22:38:39 -0700
parents 075b7e4854ba
children a52a820cfdd7
files air-quality/br-air-quality.yaml air-quality/ft-air-quality.yaml air-quality/hw.md air-quality/tr-air-quality.yaml br-air-quality.yaml ft-air-quality.yaml tr-air-quality.yaml
diffstat 7 files changed, 471 insertions(+), 375 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/air-quality/br-air-quality.yaml	Tue Aug 13 22:38:39 2024 -0700
@@ -0,0 +1,190 @@
+substitutions:
+  location: br
+  location_caps: BR
+
+esphome:
+  name: "${location}-air-quality"
+  platform: ESP32
+  board: featheresp32
+  on_boot:
+    priority: 590
+    then:
+      - script.execute: on_wifi_disconnect
+
+logger:
+  level: DEBUG
+  logs:
+    sensor: INFO
+    pmsx003: INFO
+
+wifi:
+  networks:
+    - ssid: !secret wifi_ssid
+      password: !secret wifi_password
+  on_connect:
+    then:
+      - script.execute: on_wifi_connect
+  on_disconnect:
+    then:
+      - script.execute: on_wifi_disconnect
+
+ota:
+  platform: esphome
+  password: !secret ota_password_1
+
+mqtt:
+  id: mqtt_client
+  broker: "mqtt2.bigasterisk.com"
+
+uart:
+  rx_pin: 13
+  baud_rate: 9600
+
+sensor:
+  - platform: pmsx003
+    type: PMS5003T
+    pm_1_0:
+      name: "Particulate Matter <1.0µm Concentration"
+    pm_2_5:
+      name: "Particulate Matter <2.5µm Concentration"
+      id: pm_2_5
+    pm_10_0:
+      name: "Particulate Matter <10.0µm Concentration"
+    temperature:
+      name: "air temperature C"
+      id: air_temp_c
+
+  - platform: wifi_signal
+    id: my_wifi_signal
+    name: wifi_signal
+    update_interval: 4s
+    internal: true # no mqtt
+
+spi:
+  clk_pin: GPIO18
+  mosi_pin: GPIO19
+
+font:
+  - file: "../fonts/PassionOne-Regular.ttf"
+    id: font_14
+    size: 34
+    glyphs: "%-.°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "
+
+color:
+  - { id: color_title, hex: 88888a }
+  - { id: color_wifi_h, hex: 5998de }
+  - { id: color_wifi_b, hex: aec9e2 }
+  - { id: color_pm_h, hex: 5998de }
+  - { id: color_pm_b, hex: aec9e2 }
+  - { id: color_temp_h, hex: 5998de }
+  - { id: color_temp_b, hex: aec9e2 }
+
+output:
+  - platform: ledc
+    pin: GPIO04
+    id: gpio_04_backlight_pwm
+
+light:
+  - platform: monochromatic
+    output: gpio_04_backlight_pwm
+    name: "Display Backlight"
+    id: back_light
+    restore_mode: ALWAYS_ON
+
+  - platform: fastled_clockless
+    chipset: WS2812
+    pin: GPIO27
+    num_leds: 8
+    rgb_order: GRB
+    name: "strip1"
+    id: strip1
+    effects:
+      - pulse:
+          name: "wifi_connecting_effect"
+          transition_length: 0.5s
+          update_interval: 0.5s
+          min_brightness: 0%
+          max_brightness: 40%
+
+      - addressable_lambda:
+          name: "lighthouse"
+          update_interval: 30ms
+          lambda: |-
+            static const Color lamp(255, 200, 160);
+
+            static const int32_t wid = 32;
+            static const int32_t mul = 256 / wid;
+            
+            static const int32_t ctr[] = {65, 90, 110, 120};
+            static const int32_t ctr_mirror[] = {
+              ctr[0], ctr[1], ctr[2], ctr[3], 
+              255 - ctr[3], 255 - ctr[2], 255 - ctr[1], 255 - ctr[0]
+            };
+
+            const uint32_t now = millis();
+
+            int16_t phase256 = ((int32_t)now / 10) % 256;
+
+            for (int i = 0; i < 8; i++) {
+              int16_t dist256 = abs(phase256 - ctr_mirror[i]); 
+              if (dist256 < wid) {
+                it[i] = lamp * (mul * (wid - dist256));
+              } else {
+                  it[i] =  Color::BLACK;
+              }
+            }
+
+script:
+  - id: on_wifi_disconnect
+    then:
+      - light.turn_on:
+          id: strip1
+          effect: "wifi_connecting_effect"
+          color_brightness: 100%
+          red: 100%
+          green: 0%
+          blue: 0%
+  - id: on_wifi_connect
+    then:
+      - light.turn_off:
+          id: strip1
+      # # debugging
+      # - light.turn_on:
+      #     id: strip1
+      #     effect: "lighthouse"
+      
+display:
+  # see note at https://esphome.io/components/display/ili9xxx#:~:text=For-,Lilygo%20TTGO%20Boards,-if%20you%20move
+  - platform: ili9xxx
+    model: st7789v
+    dimensions:
+      height: 240
+      width: 135
+      offset_height: 40
+      offset_width: 52
+    rotation: 0°
+    invert_colors: true
+    cs_pin: GPIO5
+    dc_pin: GPIO16
+    reset_pin: GPIO23
+    update_interval: 2s
+    pixel_mode: 16bit
+    lambda: |-
+      unsigned int row = 0;
+      unsigned int rh = 32;
+      unsigned int x0 = 0;
+      unsigned int x1 = 15;
+
+      it.print(135 / 2,    (row++)*rh, id(font_14), id(color_title), TextAlign::TOP_CENTER, "${location_caps}");
+      it.line(0, rh, 135, rh, id(color_title));
+
+      it.print(x0,    (row++)*rh, id(font_14), id(color_wifi_h), "WIFI");
+      if (std::isnan(id(my_wifi_signal).state)) {
+        it.print(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "...");
+      } else {
+        it.printf(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "%.0f%%", min(max(2 * (id(my_wifi_signal).state + 100.0), 0.0), 100.0));
+      } 
+      it.print(x0,    (row++)*rh, id(font_14), id(color_pm_h), "PM2.5");
+      it.printf(x1,   (row++)*rh, id(font_14), id(color_pm_b), "%.1f", id(pm_2_5).state);
+      it.print(x0,    (row++)*rh, id(font_14), id(color_temp_h), "TEMP °F");
+      it.printf(x1,   (row++)*rh, id(font_14), id(color_temp_b), "%.1f", 32 + (id(air_temp_c).state * 9 / 5));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/air-quality/ft-air-quality.yaml	Tue Aug 13 22:38:39 2024 -0700
@@ -0,0 +1,76 @@
+esphome: 
+  # todo: needs rename 
+  name: air_quality_indoor
+  platform: esp32
+  board: lolin32
+
+logger:
+  level: DEBUG
+  logs:
+    sensor: INFO
+    pmsx003: INFO
+    bme280.sensor: INFO
+    ccs811: INFO
+
+wifi:
+  networks:
+    - ssid: !secret wifi_ssid
+      password: !secret wifi_password
+  
+ota:
+  platform: esphome
+  password: !secret ota_password_1
+
+mqtt:
+  id: mqtt_client
+  broker: 'mqtt2.bigasterisk.com'
+                                               
+light:
+  - platform: status_led
+    id: "status_out"
+    pin: 2
+
+i2c:
+  sda: 21
+  scl: 22
+  scan: True
+  id: bus_a
+        
+    # pms pin 1 to 5V
+    # pms pin 2 to gnd
+    # pms pin 3 NC
+# original setup
+# GPIO13/RXD2 num 16 = pms tx (pin 5)
+# GPIO15/TXD2 num 17 = pms rx (pin 4)
+# or on T-Display ESP32, 
+#   pms tx pin 5 to esp 13
+#   pms rx pin 4 tp esp 12
+uart:
+  rx_pin: 16
+  baud_rate: 9600
+
+sensor:
+  - platform: bme280_i2c
+    temperature:
+      name: "BME280 Temperature"
+    pressure:
+      name: "BME280 Pressure"
+    humidity:
+      name: "BME280 Humidity"
+    address: 0x76
+    update_interval: 30s
+  - platform: ccs811
+    eco2:
+      name: "CCS811 eCO2 Value"
+    tvoc:
+      name: "CCS811 Total Volatile Organic Compound"
+    address: 0x5A
+    update_interval: 60s
+  - platform: pmsx003
+    type: PMSX003
+    pm_1_0:
+      name: "Particulate Matter <1.0µm Concentration"
+    pm_2_5:
+      name: "Particulate Matter <2.5µm Concentration"
+    pm_10_0:
+      name: "Particulate Matter <10.0µm Concentration"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/air-quality/hw.md	Tue Aug 13 22:38:39 2024 -0700
@@ -0,0 +1,15 @@
+# https://cdn.shopifycdn.net/s/files/1/0617/7190/7253/files/T-display-pin-diagram_1024x1024.jpg
+
+# https://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf
+
+
+    # pms pin 1 (blk) to 5V
+    # pms pin 2 (red) to gnd NEXT TO ESP PIN 12!!
+    # pms pin 3 (blk) NC
+# original setup
+# GPIO13/RXD2 num 16 = pms tx (pin 5 blk)
+# GPIO15/TXD2 num 17 = pms rx (pin 4 red)
+# or on T-Display ESP32, 
+#   pms tx pin 5 to esp 13
+#   pms rx pin 4 tp esp 17
+#   led strip: +5/gnd like pms; DIN to esp 27
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/air-quality/tr-air-quality.yaml	Tue Aug 13 22:38:39 2024 -0700
@@ -0,0 +1,190 @@
+substitutions:
+  location: tr
+  location_caps: TR
+
+esphome:
+  name: "${location}-air-quality"
+  platform: ESP32
+  board: featheresp32
+  on_boot:
+    priority: 590
+    then:
+      - script.execute: on_wifi_disconnect
+
+logger:
+  level: DEBUG
+  logs:
+    sensor: INFO
+    pmsx003: INFO
+
+wifi:
+  networks:
+    - ssid: !secret wifi_ssid
+      password: !secret wifi_password
+  on_connect:
+    then:
+      - script.execute: on_wifi_connect
+  on_disconnect:
+    then:
+      - script.execute: on_wifi_disconnect
+
+ota:
+  platform: esphome
+  password: !secret ota_password_1
+
+mqtt:
+  id: mqtt_client
+  broker: "mqtt2.bigasterisk.com"
+
+uart:
+  rx_pin: 13
+  baud_rate: 9600
+
+sensor:
+  - platform: pmsx003
+    type: PMS5003T
+    pm_1_0:
+      name: "Particulate Matter <1.0µm Concentration"
+    pm_2_5:
+      name: "Particulate Matter <2.5µm Concentration"
+      id: pm_2_5
+    pm_10_0:
+      name: "Particulate Matter <10.0µm Concentration"
+    temperature:
+      name: "air temperature C"
+      id: air_temp_c
+
+  - platform: wifi_signal
+    id: my_wifi_signal
+    name: wifi_signal
+    update_interval: 4s
+    internal: true # no mqtt
+
+spi:
+  clk_pin: GPIO18
+  mosi_pin: GPIO19
+
+font:
+  - file: "../fonts/PassionOne-Regular.ttf"
+    id: font_14
+    size: 34
+    glyphs: "%-.°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "
+
+color:
+  - { id: color_title, hex: 88888a }
+  - { id: color_wifi_h, hex: 5998de }
+  - { id: color_wifi_b, hex: aec9e2 }
+  - { id: color_pm_h, hex: 5998de }
+  - { id: color_pm_b, hex: aec9e2 }
+  - { id: color_temp_h, hex: 5998de }
+  - { id: color_temp_b, hex: aec9e2 }
+
+output:
+  - platform: ledc
+    pin: GPIO04
+    id: gpio_04_backlight_pwm
+
+light:
+  - platform: monochromatic
+    output: gpio_04_backlight_pwm
+    name: "Display Backlight"
+    id: back_light
+    restore_mode: ALWAYS_ON
+
+  - platform: fastled_clockless
+    chipset: WS2812
+    pin: GPIO27
+    num_leds: 8
+    rgb_order: GRB
+    name: "strip1"
+    id: strip1
+    effects:
+      - pulse:
+          name: "wifi_connecting_effect"
+          transition_length: 0.5s
+          update_interval: 0.5s
+          min_brightness: 0%
+          max_brightness: 40%
+
+      - addressable_lambda:
+          name: "lighthouse"
+          update_interval: 30ms
+          lambda: |-
+            static const Color lamp(255, 200, 160);
+
+            static const int32_t wid = 32;
+            static const int32_t mul = 256 / wid;
+            
+            static const int32_t ctr[] = {65, 90, 110, 120};
+            static const int32_t ctr_mirror[] = {
+              ctr[0], ctr[1], ctr[2], ctr[3], 
+              255 - ctr[3], 255 - ctr[2], 255 - ctr[1], 255 - ctr[0]
+            };
+
+            const uint32_t now = millis();
+
+            int16_t phase256 = ((int32_t)now / 10) % 256;
+
+            for (int i = 0; i < 8; i++) {
+              int16_t dist256 = abs(phase256 - ctr_mirror[i]); 
+              if (dist256 < wid) {
+                it[i] = lamp * (mul * (wid - dist256));
+              } else {
+                  it[i] =  Color::BLACK;
+              }
+            }
+
+script:
+  - id: on_wifi_disconnect
+    then:
+      - light.turn_on:
+          id: strip1
+          effect: "wifi_connecting_effect"
+          color_brightness: 100%
+          red: 100%
+          green: 0%
+          blue: 0%
+  - id: on_wifi_connect
+    then:
+      - light.turn_off:
+          id: strip1
+      # # debugging
+      # - light.turn_on:
+      #     id: strip1
+      #     effect: "lighthouse"
+      
+display:
+  # see note at https://esphome.io/components/display/ili9xxx#:~:text=For-,Lilygo%20TTGO%20Boards,-if%20you%20move
+  - platform: ili9xxx
+    model: st7789v
+    dimensions:
+      height: 240
+      width: 135
+      offset_height: 40
+      offset_width: 52
+    rotation: 0°
+    invert_colors: true
+    cs_pin: GPIO5
+    dc_pin: GPIO16
+    reset_pin: GPIO23
+    update_interval: 2s
+    pixel_mode: 16bit
+    lambda: |-
+      unsigned int row = 0;
+      unsigned int rh = 32;
+      unsigned int x0 = 0;
+      unsigned int x1 = 15;
+
+      it.print(135 / 2,    (row++)*rh, id(font_14), id(color_title), TextAlign::TOP_CENTER, "${location_caps}");
+      it.line(0, rh, 135, rh, id(color_title));
+
+      it.print(x0,    (row++)*rh, id(font_14), id(color_wifi_h), "WIFI");
+      if (std::isnan(id(my_wifi_signal).state)) {
+        it.print(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "...");
+      } else {
+        it.printf(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "%.0f%%", min(max(2 * (id(my_wifi_signal).state + 100.0), 0.0), 100.0));
+      } 
+      it.print(x0,    (row++)*rh, id(font_14), id(color_pm_h), "PM2.5");
+      it.printf(x1,   (row++)*rh, id(font_14), id(color_pm_b), "%.1f", id(pm_2_5).state);
+      it.print(x0,    (row++)*rh, id(font_14), id(color_temp_h), "TEMP °F");
+      it.printf(x1,   (row++)*rh, id(font_14), id(color_temp_b), "%.1f", 32 + (id(air_temp_c).state * 9 / 5));
--- a/br-air-quality.yaml	Sat Aug 03 17:24:17 2024 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-# https://cdn.shopifycdn.net/s/files/1/0617/7190/7253/files/T-display-pin-diagram_1024x1024.jpg
-# https://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf
-esphome: 
-  name: "br-air-quality"
-  platform: ESP32
-  board: featheresp32
-  on_boot:
-    priority: 590
-    then:
-      - script.execute: on_wifi_disconnect
-
-logger:
-  level: DEBUG
-  logs:
-    sensor: INFO
-    pmsx003: INFO
-
-wifi:
-  networks:
-    - ssid: !secret wifi_ssid
-      password: !secret wifi_password  
-  on_connect:
-    then:
-    - script.execute: on_wifi_connect
-  on_disconnect:
-    then:
-      - script.execute: on_wifi_disconnect
-
-ota:
-  platform: esphome
-  password: !secret ota_password_1
-
-mqtt:
-  id: mqtt_client
-  broker: 'mqtt2.bigasterisk.com'
-                                  
-    # pms pin 1 (blk) to 5V
-    # pms pin 2 (red) to gnd NEXT TO ESP PIN 12!!
-    # pms pin 3 (blk) NC
-# original setup
-# GPIO13/RXD2 num 16 = pms tx (pin 5 blk)
-# GPIO15/TXD2 num 17 = pms rx (pin 4 red)
-# or on T-Display ESP32, 
-#   pms tx pin 5 to esp 13
-#   pms rx pin 4 tp esp 17
-#   led strip: +5/gnd like pms; DIN to esp 27
-uart:
-  rx_pin: 13
-  baud_rate: 9600
-
-sensor:
-  - platform: pmsx003
-    type: PMS5003T
-    pm_1_0:
-      name: "Particulate Matter <1.0µm Concentration"
-    pm_2_5:
-      name: "Particulate Matter <2.5µm Concentration"
-      id: pm_2_5
-    pm_10_0:
-      name: "Particulate Matter <10.0µm Concentration"
-    temperature:
-      name: "air temperature C"
-      id: air_temp_c
-
-  - platform: wifi_signal
-    id: my_wifi_signal
-    name: wifi_signal
-    update_interval: 4s
-    internal: true # no mqtt
-
-spi:
-  clk_pin: GPIO18
-  mosi_pin: GPIO19
-
-font:
-  - file: 'fonts/PassionOne-Regular.ttf'
-    id: font_14
-    size: 34
-    glyphs: "%-.°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "
- 
-color:
-  - { id: color_title,  hex: 88888a }
-  - { id: color_wifi_h, hex: 5998de }
-  - { id: color_wifi_b, hex: aec9e2 }
-  - { id: color_pm_h,   hex: 5998de }
-  - { id: color_pm_b,   hex: aec9e2 }
-  - { id: color_temp_h, hex: 5998de }
-  - { id: color_temp_b, hex: aec9e2 }
-
-output:
-  - platform: ledc
-    pin: GPIO04
-    id: gpio_04_backlight_pwm
-
-light:
-  - platform: monochromatic
-    output: gpio_04_backlight_pwm
-    name: "Display Backlight"
-    id: back_light
-    restore_mode: ALWAYS_ON
-
-  - platform: fastled_clockless
-    chipset: WS2812
-    pin: GPIO27
-    num_leds: 8
-    rgb_order: GRB
-    name: "strip1"
-    id: strip1
-    effects:
-      - pulse:
-          name: "wifi_connecting_effect"
-          transition_length: 0.5s
-          update_interval: 0.5s
-          min_brightness: 0%
-          max_brightness: 20%
-
-script:
- - id: on_wifi_disconnect
-   then:
-      - light.turn_on:
-          id: strip1
-          effect: "wifi_connecting_effect"
-          color_brightness: 100%
-          red: 100%
-          green: 0%
-          blue: 0%
- - id: on_wifi_connect
-   then: 
-      - light.turn_off:
-          id: strip1
-      
-display:
-  # see note at https://esphome.io/components/display/ili9xxx#:~:text=For-,Lilygo%20TTGO%20Boards,-if%20you%20move
-  - platform: ili9xxx 
-    model: st7789v
-    dimensions:
-      height: 240
-      width: 135
-      offset_height: 40
-      offset_width: 52
-    rotation: 0°
-    invert_colors: true
-    cs_pin: GPIO5
-    dc_pin: GPIO16
-    reset_pin: GPIO23
-    update_interval: 2s
-    pixel_mode: 16bit
-    lambda: |-
-      unsigned int row = 0;
-      unsigned int rh = 32;
-      unsigned int x0 = 0;
-      unsigned int x1 = 15;
-      
-      it.print(135 / 2,    (row++)*rh, id(font_14), id(color_title), TextAlign::TOP_CENTER, "BR");
-      it.line(0, rh, 135, rh, id(color_title));
-
-      it.print(x0,    (row++)*rh, id(font_14), id(color_wifi_h), "WIFI");
-      if (std::isnan(id(my_wifi_signal).state)) {
-        it.print(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "...");
-      } else {
-        it.printf(x1,   (row++)*rh, id(font_14), id(color_wifi_b), "%.0f%%", min(max(2 * (id(my_wifi_signal).state + 100.0), 0.0), 100.0));
-      } 
-      it.print(x0,    (row++)*rh, id(font_14), id(color_pm_h), "PM2.5");
-      it.printf(x1,   (row++)*rh, id(font_14), id(color_pm_b), "%.1f", id(pm_2_5).state);
-      it.print(x0,    (row++)*rh, id(font_14), id(color_temp_h), "TEMP °F");
-      it.printf(x1,   (row++)*rh, id(font_14), id(color_temp_b), "%.1f", 32 + (id(air_temp_c).state * 9 / 5));
--- a/ft-air-quality.yaml	Sat Aug 03 17:24:17 2024 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-esphome: 
-  # todo: needs rename 
-  name: air_quality_indoor
-  platform: esp32
-  board: lolin32
-
-logger:
-  level: DEBUG
-  logs:
-    sensor: INFO
-    pmsx003: INFO
-    bme280.sensor: INFO
-    ccs811: INFO
-
-wifi:
-  networks:
-    - ssid: !secret wifi_ssid
-      password: !secret wifi_password
-  
-ota:
-  platform: esphome
-  password: !secret ota_password_1
-
-mqtt:
-  id: mqtt_client
-  broker: 'mqtt2.bigasterisk.com'
-                                               
-light:
-  - platform: status_led
-    id: "status_out"
-    pin: 2
-
-i2c:
-  sda: 21
-  scl: 22
-  scan: True
-  id: bus_a
-        
-    # pms pin 1 to 5V
-    # pms pin 2 to gnd
-    # pms pin 3 NC
-# original setup
-# GPIO13/RXD2 num 16 = pms tx (pin 5)
-# GPIO15/TXD2 num 17 = pms rx (pin 4)
-# or on T-Display ESP32, 
-#   pms tx pin 5 to esp 13
-#   pms rx pin 4 tp esp 12
-uart:
-  rx_pin: 16
-  baud_rate: 9600
-
-sensor:
-  - platform: bme280_i2c
-    temperature:
-      name: "BME280 Temperature"
-    pressure:
-      name: "BME280 Pressure"
-    humidity:
-      name: "BME280 Humidity"
-    address: 0x76
-    update_interval: 30s
-  - platform: ccs811
-    eco2:
-      name: "CCS811 eCO2 Value"
-    tvoc:
-      name: "CCS811 Total Volatile Organic Compound"
-    address: 0x5A
-    update_interval: 60s
-  - platform: pmsx003
-    type: PMSX003
-    pm_1_0:
-      name: "Particulate Matter <1.0µm Concentration"
-    pm_2_5:
-      name: "Particulate Matter <2.5µm Concentration"
-    pm_10_0:
-      name: "Particulate Matter <10.0µm Concentration"
--- a/tr-air-quality.yaml	Sat Aug 03 17:24:17 2024 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-# https://cdn.shopifycdn.net/s/files/1/0617/7190/7253/files/T-display-pin-diagram_1024x1024.jpg
-# https://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf
-esphome: 
-  name: "tr-air-quality"
-  platform: ESP32
-  board: featheresp32
-
-logger:
-  level: DEBUG
-  logs:
-    sensor: INFO
-    pmsx003: INFO
-
-wifi:
-  networks:
-    - ssid: !secret wifi_ssid
-      password: !secret wifi_password  
-  on_connect:
-    then:
-      - lambda: |-
-          id(wifi_status).publish_state("Connected");
-  on_disconnect:
-    then:
-      - lambda: |-
-          id(wifi_status).publish_state("Disconnected");
-
-ota:
-  platform: esphome
-  password: !secret ota_password_1
-
-mqtt:
-  id: mqtt_client
-  broker: 'mqtt2.bigasterisk.com'
-                                  
-
-    # pms pin 1 to 5V
-    # pms pin 2 to gnd
-    # pms pin 3 NC
-# original setup
-# GPIO13/RXD2 num 16 = pms tx (pin 5)
-# GPIO15/TXD2 num 17 = pms rx (pin 4)
-# or on T-Display ESP32, 
-#   pms tx pin 5 to esp 13
-#   pms rx pin 4 to esp 17
-uart:
-  rx_pin: 13
-  baud_rate: 9600
-
-sensor:
-  - platform: pmsx003
-    type: PMS5003T
-    pm_1_0:
-      name: "Particulate Matter <1.0µm Concentration"
-    pm_2_5:
-      name: "Particulate Matter <2.5µm Concentration"
-      id: pm_2_5
-    pm_10_0:
-      name: "Particulate Matter <10.0µm Concentration"
-    temperature:
-      name: "air temperature C"
-      id: air_temp_c
-
-spi:
-  clk_pin: GPIO18
-  mosi_pin: GPIO19
-
-font:
-  - file: 'fonts/DejaVuSerif.ttf'
-    id: font_14
-    size: 20
-    glyphs: "!%()+,-/_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ conetdisa"
- 
-color:
-  - id: color_red
-    red: 1
-    green: 0
-    blue: 0
-  - id: color_green
-    red: 0
-    green: 1
-    blue: 0
-  - id: color_blue
-    red: 0
-    green: 0
-    blue: 1
-  - id: color_gray
-    red: 0.2
-    green: 0.2
-    blue: 0.2
-  - id: color_teal_blue
-    red: 0
-    green: 0.5
-    blue: 0.45
-
-output:
-  - platform: ledc
-    pin: GPIO04
-    id: gpio_04_backlight_pwm
-
-light:
-  - platform: monochromatic
-    output: gpio_04_backlight_pwm
-    name: "Display Backlight"
-    id: back_light
-    restore_mode: ALWAYS_ON
-
-display:
-  # see note at https://esphome.io/components/display/ili9xxx#:~:text=For-,Lilygo%20TTGO%20Boards,-if%20you%20move
-  - platform: ili9xxx 
-    model: st7789v
-    dimensions:
-      height: 240
-      width: 135
-      offset_height: 40
-      offset_width: 52
-    rotation: 90°
-    invert_colors: true
-    cs_pin: GPIO5
-    dc_pin: GPIO16
-    reset_pin: GPIO23
-    update_interval: 5s
-    pixel_mode: 16bit
-    lambda: |-
-      it.printf(10, 10, id(font_14), Color(255,250,250), "TR-AIR-FILTER");
-      it.printf(10, 40, id(font_14), Color(255,0,0), "WIFI: %s", id(wifi_status).state.c_str());
-      it.printf(10, 70, id(font_14), Color(0,255,0), "PM2.5: %.1f", id(pm_2_5).state);
-      it.printf(10, 100, id(font_14), Color(0,255,255), "TEMP F: %.1f", 32 + (id(air_temp_c).state * 9 / 5));
-
-text_sensor:
-  - platform: template
-    name: "WiFi Status"
-    id: wifi_status
-    update_interval: 1s
\ No newline at end of file