Skip to content

Instantly share code, notes, and snippets.

@peeranatkankham
Last active July 28, 2024 21:03
Show Gist options
  • Save peeranatkankham/0603a53c00912432cd8639d8ba258e6c to your computer and use it in GitHub Desktop.
Save peeranatkankham/0603a53c00912432cd8639d8ba258e6c to your computer and use it in GitHub Desktop.
esphome:
name: co2
rp2040:
board: rpipicow
framework:
# Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: #Your Api Key
ota:
password: #Your ota password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
uart:
rx_pin: 17
tx_pin: 16
baud_rate: 9600
sensor:
- platform: mhz19
id : my_mhz19_id
co2:
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 30s
automatic_baseline_calibration: false
button: #creates a button to calibrate the sensor - this will reset the zero point so use it only when it's been 20 minutes either outside or in a room you know the co2 level is at a minimum
- platform: template
name: "Calibrate Zero (20 minutes at 400ppm)"
id: calibrate_zero
entity_category: diagnostic
on_press:
- mhz19.calibrate_zero: my_mhz19_id
switch: # this will expose a switch to home assistant to turn on and off the ABC
- platform: template
name: "Automatic Baseline Calibration"
entity_category: diagnostic
optimistic: true
on_turn_on:
mhz19.abc_enable: my_mhz19_id
on_turn_off:
mhz19.abc_disable: my_mhz19_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment