From 3ae0758bd60eed13d91a8178427c250f77500d5f Mon Sep 17 00:00:00 2001 From: smash Date: Tue, 15 Sep 2020 12:54:25 +0200 Subject: [PATCH] disable beep, changed: mqtt server, default wifi, enabled captive portal when no freifunk is around, red will double blink, enabled ota, individual node name from env 'co2ampel', bug fixed that would not show ppm --- co2sensor.yaml | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/co2sensor.yaml b/co2sensor.yaml index 9e4d8b0..32a3a9f 100644 --- a/co2sensor.yaml +++ b/co2sensor.yaml @@ -1,23 +1,33 @@ +substitutions: + node_name: !env_var co2ampel esphome: - name: co2_sensor_lab + name: co2ampel_${node_name} platform: ESP32 board: esp32doit-devkit-v1 on_boot: - - display.page.show: boot + - display.page.show: boot +ota: + safe_mode: True + password: !secret ota_passwd + logger: level: DEBUG wifi: ssid: !secret wifi_ssid password: !secret wifi_passwd - + ap: + ssid: "co2ampel" + password: "" +captive_portal: mqtt: - broker: mqtt.unhb + broker: co2.cyber23.de + topic_prefix: co2ampel/${node_name} birth_message: - topic: co2_sensor/status + topic: co2ampel/${node_name}/status payload: online will_message: - topic: co2_sensor/status + topic: co2ampel/${node_name}/status payload: offline uart: @@ -45,10 +55,10 @@ sensor: automatic_baseline_calibration: true uart_id: uart_mhz19 temperature: - name: "MH-Z19 Temperature" + name: ${node_name} Temperature id: mhz19_temp co2: - name: "MH-Z19 CO2" + name: ${node_name} PPM id: mhz19_co2 on_value: then: @@ -76,6 +86,7 @@ sensor: red: 50% green: 50% blue: 0% + - display.page.show: co2 else: if: condition: @@ -89,19 +100,24 @@ sensor: red: 100% green: 0% blue: 0% - - output.turn_on: buzzer - - output.ledc.set_frequency: - id: buzzer - frequency: "5000Hz" - - output.set_level: - id: buzzer - level: "80%" + # - output.turn_on: buzzer + # - output.ledc.set_frequency: + # id: buzzer + # frequency: "5000Hz" + # - output.set_level: + # id: buzzer + # level: "20%" + # - delay: 10ms + # - output.turn_off: buzzer - delay: 500ms - - output.turn_off: buzzer + - light.toggle: ws2812 + - delay: 500ms + - light.toggle: ws2812 - lambda: |- static int num_executions = 0; ESP_LOGD("main", "I am at execution number %d", num_executions); num_executions += 1; + - display.page.show: co2 i2c: sda: GPIO21 scl: GPIO22