nkitanov / iaq_board

IAQ Board is a DIY (Do-It-Yourself) device for measuring internal air quality
358 stars 32 forks source link

Question about turning the display off an the second button to reset the baseline of the voc sensor #5

Closed sebastianf closed 2 years ago

sebastianf commented 3 years ago

Hi, thank you for providing your code. It is is great!

I have a similar setup and I am new to ESPHome, so I wanted to peek in your code. I can't see where you turn off the display and where you configure the second button to reset the baseline for the voc sensor.

Can you point me in the right direction?

Thanks!

nkitanov commented 3 years ago

Hi,

Here is the code to turn off the LEDs, it's raw C++ included with lambda. I couldn't find any other way although I am sure there is more elegant way to do it. https://github.com/nkitanov/iaq_board/blob/master/firmware/includes/brightness.yaml

For the calibration of CO2 sensor (I think you are speaking for it and not VOC sensor, as VOC sensor baseline cannot be externally calibrated, it's hardcoded) here is the code, it's just a switch which executes calibration:

switch:
  - platform: template
    name: "CO2 Sensor Zero Calibration"
    turn_on_action:
      - mhz19.calibrate_zero: mh_sensor
      - switch.turn_off: co2_cal
    id: co2_cal
sebastianf commented 3 years ago

Thanks a lot. I found this for turning an OLED Display off

lambda: |-
          it.fill(COLOR_OFF);
nkitanov commented 3 years ago

Ah, nice, this can be used also in the code instead of decreasing the brightness as I do it in a dumb way.