fix flickering
This commit is contained in:
parent
badb30ae73
commit
ec8996f7b4
2 changed files with 102 additions and 6 deletions
13
poempl.yaml
13
poempl.yaml
|
@ -4,10 +4,11 @@ esphome:
|
|||
board: nodemcuv2
|
||||
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: bar
|
||||
brightness: 20%
|
||||
brightness: 100%
|
||||
effect: meter
|
||||
|
||||
# Enable logging
|
||||
|
@ -48,13 +49,13 @@ light:
|
|||
effects:
|
||||
- addressable_lambda:
|
||||
name: "meter"
|
||||
update_interval: 100ms
|
||||
update_interval: 10ms
|
||||
lambda: |-
|
||||
int val = ((id(bme280_pressure).state - 900) * 0.08) - 4;
|
||||
|
||||
Color red = Color((uint8_t)255, (uint8_t)0, (uint8_t)0, (uint8_t)51);
|
||||
Color yellow = Color((uint8_t)255, (uint8_t)255, (uint8_t)0, (uint8_t)51);
|
||||
Color green = Color((uint8_t)0, (uint8_t)255, (uint8_t)0, (uint8_t)51);
|
||||
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;
|
||||
|
||||
|
@ -92,4 +93,4 @@ sensor:
|
|||
name: "BME280 Relative Humidity"
|
||||
id: bme280_humidity
|
||||
address: 0x76
|
||||
update_interval: 5s
|
||||
update_interval: .2s
|
||||
|
|
95
poempl2.yaml
Normal file
95
poempl2.yaml
Normal file
|
@ -0,0 +1,95 @@
|
|||
esphome:
|
||||
name: poempl2
|
||||
platform: ESP8266
|
||||
board: nodemcuv2
|
||||
|
||||
on_boot:
|
||||
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: 5ms
|
||||
lambda: |-
|
||||
int val = ((id(bme280_pressure).state - 900) * 0.08) - 4;
|
||||
|
||||
Color red = Color((uint8_t)51, (uint8_t)0, (uint8_t)0, (uint8_t)255);
|
||||
Color yellow = Color((uint8_t)51, (uint8_t)51, (uint8_t)0, (uint8_t)255);
|
||||
Color green = Color((uint8_t)0, (uint8_t)51, (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
|
Loading…
Add table
Add a link
Reference in a new issue