smartpoempl/poempl.yaml
2022-01-15 11:32:54 +01:00

101 lines
2.1 KiB
YAML

esphome:
name: poempl
platform: ESP8266
board: nodemcuv2
on_boot:
priority: 300
then:
- light.turn_on:
id: bar
brightness: 100%
effect: meter
# Enable logging
logger:
ota:
password: "VkkVfr9C0C6lGxmc"
wifi:
ssid: "backspace IoT"
password: "InternetOfShit!"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Poempl Fallback Hotspot"
password: "FP6GohMzor5x"
captive_portal:
i2c:
sda: D2
scl: D1
scan: true
id: bus_a
mqtt:
broker: mqtt.core.bckspc.de
discovery: false
light:
- platform: fastled_clockless
chipset: WS2812B
id: bar
pin: D4
num_leds: 9
rgb_order: GRB
name: Bar
effects:
- addressable_lambda:
name: "meter"
update_interval: 10ms
lambda: |-
int val = ((id(bme280_pressure).state - 900) * 0.08) - 4;
if (val < 0) {
val = 0;
} else if (val > 8) {
val = 8;
}
Color red = Color((uint8_t)192, (uint8_t)0, (uint8_t)0, (uint8_t)255);
Color yellow = Color((uint8_t)128, (uint8_t)128, (uint8_t)0, (uint8_t)255);
Color green = Color((uint8_t)0, (uint8_t)192, (uint8_t)0, (uint8_t)255);
it.range(0, 9) = Color::BLACK;
if (val < 3) {
it.range(1, val+2) = red;
} else {
it.range(1, 4) = red;
}
if (val >= 3) {
if ( val < 6) {
it.range(4, val+2) = yellow;
} else {
it.range(4, 7) = yellow;
}
}
if (val >= 6) {
if ( val < 9) {
it.range(7, val+2) = green;
} else {
it.range(7, 10) = green;
}
}
sensor:
- platform: bme280
temperature:
name: "BME280 Temperature"
id: bme280_temperature
pressure:
name: "BME280 Pressure"
id: bme280_pressure
humidity:
name: "BME280 Relative Humidity"
id: bme280_humidity
address: 0x76
update_interval: .2s