diff --git a/esphome/sleepingroom.yaml b/esphome/sleepingroom.yaml index c4c2e07..1c628b4 100644 --- a/esphome/sleepingroom.yaml +++ b/esphome/sleepingroom.yaml @@ -3,19 +3,19 @@ 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: - 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" +# # Dirty hack, because on_value_range does not trigger green if sensor +# # value is within green range on boot. +# 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" wifi: ssid: "Voltage-legacy" @@ -57,10 +57,20 @@ output: - platform: ledc pin: GPIO18 id: led_green + max_power: 50% - platform: ledc pin: GPIO19 id: led_blue +# Example configuration entry +light: + - platform: rgb + id: co2_light + name: "CO2 Status LED" + red: led_red + green: led_green + blue: led_blue + # Initialize UART for Vindriktning sensor uart: rx_pin: GPIO26 @@ -71,6 +81,9 @@ text_sensor: - platform: template name: "Schlafzimmer CO2 Warnstufe" id: co2_warn + - platform: template + name: "Schlafzimmer Feinstaub Warnstufe" + id: pm25_warn sensor: # WiFi signal strength @@ -92,47 +105,23 @@ sensor: - above: 380 below: 800 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" - above: 800 below: 1200 then: - - output.set_level: - id: led_green - level: 58% - - output.set_level: - id: led_red - level: 80% - text_sensor.template.publish: id: co2_warn state: "gelb" - above: 1200 below: 1600 then: - - output.set_level: - id: led_green - level: 50% - - output.set_level: - id: led_red - level: 100% - text_sensor.template.publish: id: co2_warn state: "orange" - above: 1600 then: - - output.set_level: - id: led_green - level: 0% - - output.set_level: - id: led_red - level: 100% - text_sensor.template.publish: id: co2_warn state: "rot" @@ -161,6 +150,24 @@ sensor: - platform: pm1006 pm_2_5: name: "Feinstaub PM 2.5µm" + on_value_range: + - above: 0 + below: 35 + then: + - text_sensor.template.publish: + id: pm25_warn + state: "grün" + - above: 35 + below: 85 + then: + - text_sensor.template.publish: + id: pm25_warn + state: "orange" + - above: 85 + then: + - text_sensor.template.publish: + id: pm25_warn + state: "rot" # Analog photo diode voltage - platform: adc pin: 32 @@ -168,6 +175,17 @@ sensor: attenuation: 11db update_interval: 1s internal: true + on_value_range: + - below: 0.3 + then: + light.turn_on: + id: co2_light + brightness: 50% + - above: 0.3 + then: + light.turn_on: + id: co2_light + brightness: 100% # IR Receiver, dumps all received values into serial remote_receiver: