From ec8996f7b4cf94187dd3bbfcc2ab5cbbb85c4370 Mon Sep 17 00:00:00 2001 From: foosinn Date: Sat, 15 Jan 2022 05:59:52 +0100 Subject: [PATCH] fix flickering --- poempl.yaml | 13 +++---- poempl2.yaml | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 poempl2.yaml diff --git a/poempl.yaml b/poempl.yaml index d26ffcd..ea87c90 100644 --- a/poempl.yaml +++ b/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 diff --git a/poempl2.yaml b/poempl2.yaml new file mode 100644 index 0000000..2b1d286 --- /dev/null +++ b/poempl2.yaml @@ -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