Added CO2/PM2.5 warnings. Some new font glyphs. Some formatting. Little Rearrangements.

This commit is contained in:
Marcus Scholz 2021-12-31 21:48:27 +01:00
parent 9feaeaf265
commit 8d6c5737b0

View File

@ -149,6 +149,22 @@ text_sensor:
entity_id: weather.zuhause
id: weather
- platform: homeassistant
entity_id: sensor.schlafzimmer_co2_warnstufe
id: szco2
- platform: homeassistant
entity_id: sensor.schlafzimmer_feinstaub_warnstufe
id: szpm
- platform: homeassistant
entity_id: sensor.wohnzimmer_co2_warnstufe
id: wzco2
- platform: homeassistant
entity_id: sensor.wohnzimmer_feinstaub_warnstufe
id: wzpm
# Webserver configuration
web_server:
port: 80
@ -183,38 +199,49 @@ font:
id: footer_font
size: 15
glyphs:
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß']
'u', 'v', 'w', 'x', 'y', 'z', 'Ä', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß',
'Ü', 'ü', 'Ö', '0']
- file: 'fonts/Roboto-Regular.ttf'
id: sensor_unit
size: 20
glyphs:
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß']
'u', 'v', 'w', 'x', 'y', 'z', 'Ä', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß',
'Ü', 'ü', 'Ö', '0']
- file: 'fonts/Roboto-Medium.ttf'
id: sub_sensor_font
size: 30
glyphs:
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß']
'u', 'v', 'w', 'x', 'y', 'z', 'Ä', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß',
'Ü', 'ü', 'Ö', '0']
- file: 'fonts/Roboto-Bold.ttf'
id: big_sensor_font
size: 50
glyphs:
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'Ä', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß',
'Ü', 'ü', 'Ö', '0']
- file: 'fonts/materialdesignicons-webfont.ttf'
id: mdi_small
@ -273,7 +300,7 @@ font:
- file: 'fonts/materialdesignicons-webfont.ttf'
id: mdi_med
size: 33
size: 60
glyphs: [
'󰀦' # mdi-alert
]
@ -301,8 +328,6 @@ display:
- id: environment
lambda: |-
int pm25_danger_thres = 40;
float outdoor_temp = id(temp_outdoor).state;
int outdoor_humid = int(id(humid_outdoor).state);
float air_pressure = id(airpressure).state;
@ -414,9 +439,6 @@ display:
if(livingroom_pm25 < 255 && livingroom_pm25 >=0) {
it.printf(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%3d", livingroom_pm25);
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
if(livingroom_pm25 >= pm25_danger_thres) {
it.print(37, 114 + offsetY, id(mdi_med), TextAlign::BASELINE_CENTER, "󰀦"); // warning
}
}
else {
it.print(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
@ -460,9 +482,6 @@ display:
if(sleepingroom_pm25 < 255 && sleepingroom_pm25 >=0) {
it.printf(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%3d", sleepingroom_pm25);
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
if(sleepingroom_pm25 >= pm25_danger_thres) {
it.print(37, 114 + offsetY, id(mdi_med), TextAlign::BASELINE_CENTER, "󰀦"); // warning
}
}
else {
it.print(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
@ -548,7 +567,7 @@ display:
/* Moon phase display */
if(id(moonphase).has_state()) {
int x = 10 + offsetX;
int y = 200;
int y = 116;
if (id(moonphase).state == "new_moon") {
// new moon
it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽤");
@ -588,6 +607,12 @@ display:
}
}
/* Warnings */
if(id(szco2).state == "rot" || id(szpm).state == "rot" || id(wzco2).state == "rot" || id(wzpm).state == "rot") {
it.print(10 + offsetX, 200, id(mdi_med), TextAlign::BASELINE_LEFT, "󰀦");
it.print(80 + offsetX, 200, id(big_sensor_font), TextAlign::BASELINE_LEFT, "Lüften!");
}
if(id(sun_state).has_state()) {
ESP_LOGI("Sun", "State of the sun: %s, sunrise: %s, sunset: %s",
id(sun_state).state.c_str(), sunrise, sunset);