Code cleanup, in-line code comments. Added purple light to indicate required co2 sensor calibration.

This commit is contained in:
Marcus Scholz 2021-09-04 12:28:10 +02:00
parent e66d1aa9b7
commit 0a15361088

View File

@ -3,19 +3,15 @@ esphome:
platform: ESP32
board: nodemcu-32s
# # Dirty hack, because on_value_range does not trigger green if sensor
# # value is within green range on boot.
# on_boot:
# Startup animation
#on_boot:
# then:
# - output.set_level:
# id: led_green
# level: 58%
# - output.set_level:
# id: led_red
# level: 0%
# - text_sensor.template.publish:
# id: co2_warn
# state: "grün"
#script:
# - id: startup_animation
# then:
# - delay: 5s
# -
wifi:
ssid: "Voltage-legacy"
@ -62,7 +58,7 @@ output:
pin: GPIO19
id: led_blue
# Example configuration entry
# Define RGB mode for LED
light:
- platform: rgb
id: co2_light
@ -70,6 +66,7 @@ light:
red: led_red
green: led_green
blue: led_blue
internal: true
# Initialize UART for Vindriktning sensor
uart:
@ -90,11 +87,12 @@ sensor:
- platform: wifi_signal
name: "WiFi Signalstärke"
update_interval: 60s
# SCD30 CO2 + Temperature + Humidity Sensor
# • Luftqualität Kategorie 1: die LEDs leuchten grün (bis 800 ppm)
# • Luftqualität Kategorie 2: die LEDs leuchten gelb (900-1200 ppm)
# • Luftqualität Kategorie 3: die LEDs leuchten orange (1200 bis 1600ppm)
# • Luftqualität Kategorie 4: die LEDs leuchten rot (ab 1600ppm)
# SCD30 CO2 + temperature + humidity sensor
# * air quality category 0: LED is purple, sensor needs calibration (<400ppm)
# • air quality category 1: LED is green (400-800ppm)
# • air quality category 2: LED is yellow (900-1200ppm)
# • air quality category 3: LED is orange/amber (1200 bis 1600ppm)
# • air quality category 4: LED is red (1600-2000ppm)
- platform: scd30
i2c_id: bus_a
co2:
@ -102,29 +100,59 @@ sensor:
id: co2_value
accuracy_decimals: 1
on_value_range:
- above: 380
- below: 400
then:
- text_sensor.template.publish:
id: co2_warn
state: "Kalibrierung nötig"
- light.turn_on:
id: co2_light
red: 75%
green: 0%
blue: 100%
- above: 400
below: 800
then:
- text_sensor.template.publish:
id: co2_warn
state: "grün"
- light.turn_on:
id: co2_light
red: 0%
green: 100%
blue: 9%
- above: 800
below: 1200
then:
- text_sensor.template.publish:
id: co2_warn
state: "gelb"
- light.turn_on:
id: co2_light
red: 100%
green: 100%
blue: 0%
- above: 1200
below: 1600
then:
- text_sensor.template.publish:
id: co2_warn
state: "orange"
- light.turn_on:
id: co2_light
red: 100%
green: 75%
blue: 0%
- above: 1600
then:
- text_sensor.template.publish:
id: co2_warn
state: "rot"
- light.turn_on:
id: co2_light
red: 100%
green: 0%
blue: 0%
temperature:
name: "Schlafzimmer Temperatur"
accuracy_decimals: 2
@ -214,8 +242,3 @@ switch:
- remote_transmitter.transmit_samsung:
data: 0xE0E040BF
nbits: 32
#script:
# - id: startup_animation
# then:
# - delay: 5s
# -