From cf50c602d7c6d3cf8103b8c8b88c183b5e6b2f8b Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 27 May 2025 21:59:50 -0400 Subject: [PATCH] Add textual environmental sensors --- microenv.yaml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/microenv.yaml b/microenv.yaml index 7bf607a..66ded01 100644 --- a/microenv.yaml +++ b/microenv.yaml @@ -226,6 +226,57 @@ text_sensor: mac_address: name: "WiFi MAC Address" + # VOC Level + - platform: template + name: "VOC Level" + icon: mdi:radiator + lambda: |- + int tvoc = id(sgp30_tvoc).state; + if (tvoc < 65) return {"Great"}; + if (tvoc < 220) return {"Good"}; + if (tvoc < 660) return {"Fair"}; + if (tvoc < 2200) return {"Poor"}; + return {"Bad"}; + update_interval: 15s + + # CO2 Level + - platform: template + name: "CO2 Level" + icon: mdi:molecule-co2 + lambda: |- + int eco2 = id(sgp30_eco2).state; + if (eco2 < 500) return {"Great"}; + if (eco2 < 800) return {"Good"}; + if (eco2 < 1200) return {"Fair"}; + if (eco2 < 2000) return {"Poor"}; + return {"Bad"}; + update_interval: 15s + + # IAQ Classification + - platform: template + name: "IAQ Classification" + icon: mdi:air-purifier + lambda: |- + int iaq = id(iaq_index).state; + if (iaq == 5) return {"Great"}; + if (iaq == 4) return {"Good"}; + if (iaq == 3) return {"Fair"}; + if (iaq == 2) return {"Poor"}; + return {"Bad"}; + update_interval: 15s + + # Room Health + - platform: template + name: "Room Health" + icon: mdi:home-thermometer + lambda: |- + int score = id(room_health).state; + if (score == 4) return {"Optimal"}; + if (score == 3) return {"Fair"}; + if (score == 2) return {"Poor"}; + return {"Bad"}; + update_interval: 15s + button: - platform: restart name: "ESP32 Restart"