diff --git a/.gitignore b/.gitignore index ae945fa..34f70f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ venv/ +.esphome/ diff --git a/co2-sensor.yaml b/co2-sensor.yaml new file mode 100644 index 0000000..6574154 --- /dev/null +++ b/co2-sensor.yaml @@ -0,0 +1,114 @@ +esphome: + name: co2-sensor-raum3 + friendly_name: "CO2 Sensor Raum 3" + area: "Raum 3" + on_boot: + - priority: -100 + then: + - light.turn_on: { + id: co2_sensor_raum3_led, + red: 0%, green: 0%, blue: 100% + } + +esp8266: + board: d1_mini + +# Enable logging +logger: + baud_rate: 0 + +# Enable Home Assistant API +api: + password: "" + services: + - service: calibrate + then: + - mhz19.calibrate_zero: co2_sensor_raum3_sensor + +ota: + - platform: esphome + password: !secret ota_password + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "CO2 Sensor Raum 3 Fallback" + password: !secret ap_password + + manual_ip: + static_ip: 172.23.23.31 + gateway: 172.23.23.1 + subnet: 255.255.255.0 + +captive_portal: + +uart: + rx_pin: GPIO3 + tx_pin: GPIO1 + baud_rate: 9600 + +sensor: + - platform: mhz19 + id: co2_sensor_raum3_sensor + co2: + id: co2_sensor_raum3_messwert + name: "Messwert" + on_value_range: + - below: 700 + then: + - light.turn_on: { + id: co2_sensor_raum3_led, + red: 32%, green: 57%, blue: 12%, + effect: none + } + - above: 700 + below: 1200 + then: + - light.turn_on: { + id: co2_sensor_raum3_led, + red: 96%, green: 76%, blue: 6%, + effect: none + } + - above: 1200 + below: 1500 + then: + - light.turn_on: { + id: co2_sensor_raum3_led, + red: 100%, green: 12%, blue: 0%, + effect: none + } + - above: 1500 + then: + - light.turn_on: { + id: co2_sensor_raum3_led, + red: 100%, green: 12%, blue: 0%, + effect: blink + } + temperature: + id: co2_sensor_raum3_temperatur + name: "Temperatur" + update_interval: 60s + automatic_baseline_calibration: false + +light: + - platform: neopixelbus + id: co2_sensor_raum3_led + name: "LED" + type: GRB + variant: WS2812 + pin: D2 + num_leds: 7 + effects: + - pulse: + name: blink + transition_length: 0s + update_interval: 1s + +binary_sensor: + - platform: gpio + id: co2_sensor_raum3_button + name: "Button" + pin: D6