Added serverroom panel.

This commit is contained in:
Marcus Scholz 2021-10-09 14:22:19 +02:00
parent f2fc5e391a
commit 632a4d6a6f

View File

@ -57,8 +57,10 @@ sensor:
pin: 22
temperature:
name: "Temperatur"
id: temp_serverroom
humidity:
name: "Luftfeuchtigkeit"
id: humid_serverroom
update_interval: 60s
# WiFi signal strength
@ -175,7 +177,7 @@ font:
'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/', 'º', 'µ', '³', 'ß']
- file: 'fonts/Roboto-Regular.ttf'
id: big_sensor_unit
id: sensor_unit
size: 20
glyphs:
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
@ -270,8 +272,12 @@ display:
int sleepingroom_humid = int(id(humid_sleepingroom).state);
int sleepingroom_pm25 = int(id(pm25_sleepingroom).state);
float sleepingroom_co2 = id(co2_sleepingroom).state;
float serverroom_temp = id(temp_serverroom).state;
int serverroom_humid = id(humid_serverroom).state;
char sunrise[5] = "";
char sunset[5] = "";
int offsetX = 0;
int offsetY = 0;
/*
This is Commander1024 doing awful string / time fuckerey full of
@ -296,7 +302,7 @@ display:
/* OUTSIDE */
it.print(10, 10, id(big_sensor_unit), "Umwelt");
it.print(10, 10, id(sensor_unit), "Umwelt");
/*
Draw the outline of a rectangle with the top left at [78,21],
a width of 305 and a height of 3
@ -307,9 +313,9 @@ display:
id(sun_state).state.c_str(), sunrise, sunset);
it.print(10, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); // sun-up
it.printf(50, 75, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunrise);
it.printf(50, 75, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunrise);
it.print(135, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖛"); // sun-down
it.printf(175, 75, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset);
it.printf(175, 75, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset);
}
it.print(250, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰊚"); // air pressure icon
it.print(375, 75, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer icon
@ -380,8 +386,8 @@ display:
}
/* Livingroom */
int offsetY = 127;
it.print(10, 10 + offsetY, id(big_sensor_unit), "Wohnzimmer");
offsetY = 127;
it.print(10, 10 + offsetY, id(sensor_unit), "Wohnzimmer");
it.filled_rectangle(136, 21 + offsetY, 247, 3);
it.print(10, 114 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰮬"); // PM2.5
it.print(375, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer
@ -405,28 +411,28 @@ display:
if(livingroom_co2 >=380 && livingroom_co2 <= 20000) {
it.printf(150, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%4.0f", livingroom_co2);
it.print(150, 50 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "ppm");
it.print(150, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm");
}
else {
it.print(150, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
it.print(150, 50 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "ppm³");
it.print(150, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm³");
}
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(big_sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
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, "- ");
it.print(205, 114 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
}
/* Sleepingroom */
offsetY = 247;
it.print(10, 10 + offsetY, id(big_sensor_unit), "Schlafzimmer");
it.print(10, 10 + offsetY, id(sensor_unit), "Schlafzimmer");
it.filled_rectangle(144, 21 + offsetY, 239, 3);
it.print(10, 114 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰮬"); // PM2.5
it.print(375, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer
@ -450,32 +456,60 @@ display:
if(sleepingroom_co2 >=380 && sleepingroom_co2 <= 20000) {
it.printf(150, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%4.0f", sleepingroom_co2);
it.print(150, 50 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "ppm");
it.print(150, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm");
}
else {
it.print(150, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
it.print(150, 50 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "ppm³");
it.print(150, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm³");
}
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(big_sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
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, "- ");
it.print(205, 114 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
}
/* Weather */
offsetX = 390;
it.print(10 + offsetX, 10, id(sensor_unit), "Wetter");
it.filled_rectangle(80 + offsetX, 21, 155, 3);
/* Serverroom */
offsetY = 247;
it.print(10 + offsetX, 10 + offsetY, id(sensor_unit), "Serverraum");
it.filled_rectangle(125 + offsetX, 21 + offsetY, 110, 3);
it.print(227 + offsetX, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer
it.print(227+ offsetX, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); // water percent
if(serverroom_temp > -100 && serverroom_temp < 100) {
it.printf(207 + offsetX, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fºC", serverroom_temp);
}
else {
it.print(207 + offsetX, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - ºC");
}
if(serverroom_humid >=0 && serverroom_humid <= 100) {
it.printf(207 + offsetX, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%3d%%", serverroom_humid);
}
else {
it.print(207 + offsetX, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %");
}
/* FOOTER */
it.strftime(610, 374 , id(footer_font), TextAlign::BASELINE_RIGHT , "Aktualisiert um %d.%m.%Y %H:%M", id(homeassistant_time).now());
it.strftime(614, 380, id(footer_font), TextAlign::BASELINE_RIGHT , "Aktualisiert um %d.%m.%Y %H:%M", id(homeassistant_time).now());
/* WiFi Signal Strenght */
if(id(wifisignal).has_state()) {
int x = 626;
int y = 376;
int x = 630;
int y = 384;
if (id(wifisignal).state >= -50) {
//Excellent
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "󰤨");