smartpoempl/poempl2.yaml
2022-01-15 11:27:52 +01:00

96 lines
2 KiB
YAML

esphome:
name: poempl2
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;
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(0, val+1) = red;
} else {
it.range(0, 3) = red;
}
if (val >= 3) {
if ( val < 6) {
it.range(3, val+1) = yellow;
} else {
it.range(3, 6) = yellow;
}
}
if (val >= 6) {
if ( val < 9) {
it.range(6, val+1) = green;
} else {
it.range(6, 9) = 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