final?
This commit is contained in:
parent
937fd99148
commit
badb30ae73
1 changed files with 35 additions and 38 deletions
73
poempl.yaml
73
poempl.yaml
|
@ -8,12 +8,8 @@ esphome:
|
|||
- light.turn_on:
|
||||
id: bar
|
||||
brightness: 20%
|
||||
red: 0
|
||||
green: 0
|
||||
blue: 20%
|
||||
effect: meter
|
||||
|
||||
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
|
@ -50,23 +46,39 @@ light:
|
|||
rgb_order: GRB
|
||||
name: Bar
|
||||
effects:
|
||||
- strobe
|
||||
- platform: partition
|
||||
name: bar00
|
||||
segments:
|
||||
- id: bar
|
||||
from: 0
|
||||
to: 0
|
||||
effects:
|
||||
- strobe
|
||||
- platform: partition
|
||||
name: bar01
|
||||
segments:
|
||||
- id: bar
|
||||
from: 1
|
||||
to: 1
|
||||
effects:
|
||||
- strobe
|
||||
- addressable_lambda:
|
||||
name: "meter"
|
||||
update_interval: 100ms
|
||||
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);
|
||||
|
||||
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
|
||||
|
@ -76,23 +88,8 @@ sensor:
|
|||
pressure:
|
||||
name: "BME280 Pressure"
|
||||
id: bme280_pressure
|
||||
on_value:
|
||||
- then:
|
||||
- light.addressable_set:
|
||||
id: bar
|
||||
red: 20%
|
||||
green: 0
|
||||
blue: 0
|
||||
white: 20%
|
||||
range_from: 0
|
||||
range_to: !lambda |
|
||||
int val = (id(bme280_pressure).state - 900) * 0.08;
|
||||
ESP_LOGD("main", "value %d", val);
|
||||
return val - 3;
|
||||
|
||||
|
||||
humidity:
|
||||
name: "BME280 Relative Humidity"
|
||||
id: bme280_humidity
|
||||
address: 0x76
|
||||
update_interval: 0.5s
|
||||
update_interval: 5s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue