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,150 +1,151 @@
substitutions:
node_name: !env_var co2ampel
node_name: !env_var co2ampel
esphome:
name: co2ampel_${node_name}
platform: ESP32
board: esp32doit-devkit-v1
on_boot:
- display.page.show: boot
name: 'co2ampel_${node_name}'
platform: ESP32
board: esp32doit-devkit-v1
on_boot:
- display.page.show: boot
on_loop:
- display.page.show: co2
ota:
safe_mode: True
password: !secret ota_passwd
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:
ssid: !secret wifi_ssid
password: !secret wifi_passwd
ap:
ssid: co2ampel
password: ''
captive_portal: null
mqtt:
broker: co2.cyber23.de
topic_prefix: co2ampel/${node_name}
birth_message:
topic: co2ampel/${node_name}/status
payload: online
will_message:
topic: co2ampel/${node_name}/status
payload: offline
broker: co2.cyber23.de
topic_prefix: 'co2ampel/${node_name}'
birth_message:
topic: 'co2ampel/${node_name}/status'
payload: online
will_message:
topic: 'co2ampel/${node_name}/status'
payload: offline
uart:
rx_pin: GPIO16
tx_pin: GPIO17
baud_rate: 9600
id: uart_mhz19
rx_pin: GPIO16
tx_pin: GPIO17
baud_rate: 9600
id: uart_mhz19
light:
- platform: neopixelbus
pin: GPIO4
num_leds: 12
name: "ws2812 ring"
id: "ws2812"
restore_mode: ALWAYS_OFF
- platform: fastled_clockless
chipset: WS2812B
pin: GPIO4
num_leds: 12
max_refresh_rate: 500ms
rgb_order: GRB
name: ws2812 ring
id: ws2812
restore_mode: ALWAYS_OFF
output:
- platform: ledc
pin: GPIO12
id: buzzer
- platform: ledc
pin: GPIO12
id: buzzer
sensor:
- platform: mhz19
update_interval: 10s
automatic_baseline_calibration: true
uart_id: uart_mhz19
temperature:
name: ${node_name} Temperature
id: mhz19_temp
co2:
name: ${node_name} PPM
id: mhz19_co2
on_value:
then:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 0
below: 800
then:
- light.turn_off:
id: ws2812
- display.page.show: co2
else:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 800
below: 1000
then:
- light.turn_on:
id: ws2812
brightness: 80%
red: 50%
green: 50%
blue: 0%
- display.page.show: co2
else:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 1000
then:
- light.turn_on:
id: ws2812
brightness: 100%
red: 100%
green: 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
- light.toggle: ws2812
- delay: 500ms
- light.toggle: ws2812
- delay: 500ms
- 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
- platform: mhz19
update_interval: 10s
automatic_baseline_calibration: true
uart_id: uart_mhz19
temperature:
name: '${node_name} Temperature'
id: mhz19_temp
co2:
name: '${node_name} PPM'
id: mhz19_co2
on_value:
then:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 0
below: 800
then:
- light.turn_on:
id: ws2812
brightness: 80%
red: 0%
green: 100%
blue: 0%
- display.page.show: co2
else:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 800
below: 1000
then:
- light.turn_on:
id: ws2812
brightness: 80%
red: 50%
green: 40%
blue: 0%
- display.page.show: co2
else:
if:
condition:
sensor.in_range:
id: mhz19_co2
above: 1000
then:
- light.turn_on:
id: ws2812
brightness: 100%
red: 100%
green: 0%
blue: 0%
- delay: 500ms
- light.toggle: ws2812
- delay: 500ms
- light.toggle: ws2812
- delay: 500ms
- 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
sda: GPIO21
scl: GPIO22
font:
- file: "font.ttf"
id: cust_font
size: 70
- file: font.ttf
id: cust_font
size: 65
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
brightness: 100%
update_interval: 10s
pages:
- id: boot
lambda: |-
it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER, ":-)");
- id: co2
lambda: |-
- platform: ssd1306_i2c
model: SSD1306 128x64
address: 60
brightness: 100%
update_interval: 10s
pages:
- id: boot
lambda: |-
it.printf(64, 0, id(cust_font), COLOR_ON, TextAlign::TOP_CENTER,":-)");
- id: co2
lambda: |-
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, 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, 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);