Compare commits

...

1 Commits

Author SHA1 Message Date
Stefan Heinrichsen 2a231b27c0 switched from neopixelbus to fastled; harmonized indentation in whole file 2020-11-07 20:54:59 +01:00
1 changed files with 130 additions and 129 deletions

View File

@ -1,33 +1,36 @@
substitutions: substitutions:
node_name: !env_var co2ampel node_name: !env_var co2ampel
esphome: esphome:
name: co2ampel_${node_name} name: 'co2ampel_${node_name}'
platform: ESP32 platform: ESP32
board: esp32doit-devkit-v1 board: esp32doit-devkit-v1
on_boot: on_boot:
- display.page.show: boot - display.page.show: boot
on_loop:
- display.page.show: co2
ota: ota:
safe_mode: True safe_mode: true
password: !secret ota_passwd password: !secret ota_passwd
logger:
level: DEBUG
wifi: wifi:
ssid: !secret wifi_ssid ssid: !secret wifi_ssid
password: !secret wifi_passwd password: !secret wifi_passwd
ap: ap:
ssid: "co2ampel" ssid: co2ampel
password: "" password: ''
captive_portal:
captive_portal: null
mqtt: mqtt:
broker: co2.cyber23.de broker: co2.cyber23.de
topic_prefix: co2ampel/${node_name} topic_prefix: 'co2ampel/${node_name}'
birth_message: birth_message:
topic: co2ampel/${node_name}/status topic: 'co2ampel/${node_name}/status'
payload: online payload: online
will_message: will_message:
topic: co2ampel/${node_name}/status topic: 'co2ampel/${node_name}/status'
payload: offline payload: offline
uart: uart:
@ -37,11 +40,14 @@ uart:
id: uart_mhz19 id: uart_mhz19
light: light:
- platform: neopixelbus - platform: fastled_clockless
chipset: WS2812B
pin: GPIO4 pin: GPIO4
num_leds: 12 num_leds: 12
name: "ws2812 ring" max_refresh_rate: 500ms
id: "ws2812" rgb_order: GRB
name: ws2812 ring
id: ws2812
restore_mode: ALWAYS_OFF restore_mode: ALWAYS_OFF
output: output:
@ -55,10 +61,10 @@ sensor:
automatic_baseline_calibration: true automatic_baseline_calibration: true
uart_id: uart_mhz19 uart_id: uart_mhz19
temperature: temperature:
name: ${node_name} Temperature name: '${node_name} Temperature'
id: mhz19_temp id: mhz19_temp
co2: co2:
name: ${node_name} PPM name: '${node_name} PPM'
id: mhz19_co2 id: mhz19_co2
on_value: on_value:
then: then:
@ -69,8 +75,12 @@ sensor:
above: 0 above: 0
below: 800 below: 800
then: then:
- light.turn_off: - light.turn_on:
id: ws2812 id: ws2812
brightness: 80%
red: 0%
green: 100%
blue: 0%
- display.page.show: co2 - display.page.show: co2
else: else:
if: if:
@ -84,7 +94,7 @@ sensor:
id: ws2812 id: ws2812
brightness: 80% brightness: 80%
red: 50% red: 50%
green: 50% green: 40%
blue: 0% blue: 0%
- display.page.show: co2 - display.page.show: co2
else: else:
@ -100,15 +110,6 @@ sensor:
red: 100% red: 100%
green: 0% green: 0%
blue: 0% blue: 0%
# - 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 - delay: 500ms
- light.toggle: ws2812 - light.toggle: ws2812
- delay: 500ms - delay: 500ms
@ -117,7 +118,7 @@ sensor:
- light.toggle: ws2812 - light.toggle: ws2812
- delay: 500ms - delay: 500ms
- light.toggle: ws2812 - light.toggle: ws2812
- lambda: |- - lambda: >-
static int num_executions = 0; static int num_executions = 0;
ESP_LOGD("main", "I am at execution number %d", num_executions); ESP_LOGD("main", "I am at execution number %d", num_executions);
num_executions += 1; num_executions += 1;
@ -127,24 +128,24 @@ i2c:
scl: GPIO22 scl: GPIO22
font: font:
- file: "font.ttf" - file: font.ttf
id: cust_font id: cust_font
size: 70 size: 65
display: display:
- platform: ssd1306_i2c - platform: ssd1306_i2c
model: "SSD1306 128x64" model: SSD1306 128x64
address: 0x3C address: 60
brightness: 100% brightness: 100%
update_interval: 10s update_interval: 10s
pages: pages:
- id: boot - id: boot
lambda: |- lambda: |-
it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER, ":-)"); it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER,":-)");
- id: co2 - id: co2
lambda: |- lambda: |-
int ergb; int ergb;
ergb = id(mhz19_co2).state/100; ergb = id(mhz19_co2).state;
it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER, "%.0i", ergb); it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER, "%.0i", ergb);
# it.printf(64, 16, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER, "%.0fPPM", id(mhz19_co2).state); # it.printf(64, 16, id(cust_font), COLOR_ON,TextAlign::TOP_CENTER, "%.0fPPM", id(mhz19_co2).state);
# it.printf(64, 40, id(cust_font),TextAlign::TOP_CENTER, "%.0f°C", id(mhz19_temp).state); # it.printf(64, 40, id(cust_font),TextAlign::TOP_CENTER,"%.0f°C", id(mhz19_temp).state);