koenvervloesem / ESPHome-Air-Quality-Monitor

ESPHome configuration for a DIY indoor air quality monitor for CO₂ concentration, PM2.5 and PM10 concentrations, and temperature, humidity and pressure
https://koenvervloesem.github.io/ESPHome-Air-Quality-Monitor
MIT License
89 stars 10 forks source link

change the colour of the text on the screen #6

Closed April-ha closed 1 year ago

April-ha commented 1 year ago

I have in my possession these sensors which I will try to adapt to your realization.

Sensirion SPS30 PM 2.5 Sensirion SCD40 CO2 Sensirion SGP30 TVOC LilyGO TTGO T-Display ESP32

As I do not use LEDs, is it possible that the text line on the display (CO2:849 ppm) changes colour depending on the CO2 value? green < 800 yellow 800 - 1200 red > 1200

Thank you very much for your project which seems very interesting

koenvervloesem commented 1 year ago

That's a good idea! Yes, that should be possible by referring to the CO₂ threshold values in the lambda, and maybe add a function to the display utilities to return the right color based on the CO₂ value. Are you up to the task, or were you asking me to implement this?

April-ha commented 1 year ago

thanks you for your answer. My knowledge of ESPhome is very limited. I think you have to change (color_gray) to a variable that you fill in the aqi module? it.printf((240 / 2), (110 / 3) * 1 + 5, id(roboto_24), id(color_gray), TextAlign::CENTER, "CO2: %.0f ppm", id(co2_value).state); I'll look into it, but if you have the time, it will save me hours of work.

I should manage to create the modules for the Sensirion sensors, They are all on the I2c bus.

April-ha commented 1 year ago

Since my sensors were completely different, I rewrote everything and managed to colorize the value of my sensors. Your yaml helped me a lot in understanding ESPhome. Thanks