Code:
esphome:
name: co2
friendly_name: CO2
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "LSvuWpCuxsP9gPFWIreNFSDZ4yvhlPMzrKsILV9qSnQ="
ota:
password: "8bfc5dfa222020bd88526e2707a90e6c"
wifi:
ssid: "Juergen Ap2"
password: "KonBanWa#f0"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Co2 Fallback Hotspot"
password: "konbanwa"
captive_portal:
# Service für HA
#services:
# - service: mhz19_calibrate_zero
# then:
# - mhz19_calibrate_zero: sens1
# serielle Schnittstelle
uart:
rx_pin: GPIO4
tx_pin: GPIO5
baud_rate: 9600
sensor:
- platform: mhz19
co2:
name: "MH-Z19 CO2 Value"
id: co2val
on_value_range:
- below: 1200
then:
- switch.turn_on: green_pin
- switch.turn_off: yellow_pin
- switch.turn_off: red_pin
- above: 1200
then:
- switch.turn_off: green_pin
- switch.turn_on: yellow_pin
- switch.turn_off: red_pin
- above: 1800
then:
- switch.turn_off: green_pin
- switch.turn_off: yellow_pin
- switch.turn_on: red_pin
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
automatic_baseline_calibration: False
id: sens1
# LED konfig
switch:
- platform: gpio
pin: GPIO12
id: red_pin
name: "CO2 rot"
- platform: gpio
pin: GPIO14
id: yellow_pin
name: "CO2 gelb"
- platform: gpio
pin: GPIO16
id: green_pin
name: "CO2 grün"