Add textual environmental sensors

This commit is contained in:
Joshua Boniface 2025-05-27 21:59:50 -04:00
parent b2aa52f801
commit cf50c602d7

View File

@ -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"