Color-code grid power and refine solar display colors
This commit is contained in:
@@ -253,7 +253,10 @@ display:
|
|||||||
if (id(page_index) == 0) {
|
if (id(page_index) == 0) {
|
||||||
it.printf(12, 12, id(font_small), Color::WHITE, "Netzleistung");
|
it.printf(12, 12, id(font_small), Color::WHITE, "Netzleistung");
|
||||||
if (id(grid_power).has_state()) {
|
if (id(grid_power).has_state()) {
|
||||||
it.printf(308, 32, id(font_value), Color::WHITE, TextAlign::TOP_RIGHT,
|
const Color grid_power_color = id(grid_power).state >= 0
|
||||||
|
? Color(143, 190, 223) // #8FBEDF: positive grid power
|
||||||
|
: Color(150, 110, 217); // #966ED9: negative grid power
|
||||||
|
it.printf(308, 32, id(font_value), grid_power_color, TextAlign::TOP_RIGHT,
|
||||||
"%+.0f W", id(grid_power).state);
|
"%+.0f W", id(grid_power).state);
|
||||||
} else {
|
} else {
|
||||||
it.printf(308, 42, id(font_value), Color::WHITE, TextAlign::TOP_RIGHT,
|
it.printf(308, 42, id(font_value), Color::WHITE, TextAlign::TOP_RIGHT,
|
||||||
@@ -277,16 +280,16 @@ display:
|
|||||||
it.printf(12, 138, id(font_small), Color::WHITE, "Balkonkraftwerk");
|
it.printf(12, 138, id(font_small), Color::WHITE, "Balkonkraftwerk");
|
||||||
// Daily solar energy is aligned to the left of the current solar-power reading.
|
// Daily solar energy is aligned to the left of the current solar-power reading.
|
||||||
if (id(solar_energy_daily).has_state()) {
|
if (id(solar_energy_daily).has_state()) {
|
||||||
it.printf(12, 180, id(font_small), Color(255, 215, 0), "Solar: %.2f kWh",
|
it.printf(12, 180, id(font_small), Color(255, 170, 40), "Solar: %.2f kWh",
|
||||||
id(solar_energy_daily).state);
|
id(solar_energy_daily).state);
|
||||||
} else {
|
} else {
|
||||||
it.printf(12, 180, id(font_small), Color(255, 215, 0), "Solar: -- kWh");
|
it.printf(12, 180, id(font_small), Color(255, 170, 40), "Solar: -- kWh");
|
||||||
}
|
}
|
||||||
if (id(balcony_solar_power).has_state()) {
|
if (id(balcony_solar_power).has_state()) {
|
||||||
it.printf(308, 158, id(font_value), Color(255, 215, 0), TextAlign::TOP_RIGHT,
|
it.printf(308, 158, id(font_value), Color(255, 170, 40), TextAlign::TOP_RIGHT,
|
||||||
"%.0f W", id(balcony_solar_power).state);
|
"%.0f W", id(balcony_solar_power).state);
|
||||||
} else {
|
} else {
|
||||||
it.printf(308, 168, id(font_value), Color(255, 215, 0), TextAlign::TOP_RIGHT,
|
it.printf(308, 168, id(font_value), Color(255, 170, 40), TextAlign::TOP_RIGHT,
|
||||||
"-- W");
|
"-- W");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user