I’m trying to change the text color based on a sensor value but it just displays everything in white color.
Can anyone see if I’m doing something wrong?
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
address: 0x3C
lambda: |-
it.printf(0, 0, id(calibri), "Solar Generation: %s", id(current_solar_generation).state.c_str());
it.printf(0, 13, id(calibri), "Battery SOC: %s", id(solar_battery_soc).state.c_str());
it.printf(0, 26, id(calibri), "Battery Power: %s", id(solar_battery_power).state.c_str());
it.printf(0, 39, id(calibri), "House Load: %s", id(current_house_consumption).state.c_str());
if (id(grid_status).state == "Exporting") {
it.printf(0, 52, id(calibri), id(light_green), "Exporting: %s", id(current_grid_power).state.c_str());
}
else {
it.printf(0, 52, id(calibri), id(light_red), "Importing: %s", id(current_grid_power).state.c_str());
}
font:
- file: 'calibri.ttf'
id: calibri
size: 12
color:
- id: light_red
red: 100%
green: 20%
blue: 25%
white: 0%
- id: light_green
red: 0%
green: 100%
blue: 25%
white: 0%