Compare commits

..

3 Commits

2 changed files with 108 additions and 37 deletions

View File

@ -83,6 +83,22 @@ sensor:
entity_id: sensor.wohnzimmer_co2
id: co2_livingroom
- platform: homeassistant
entity_id: sensor.feinstaub_pm_2_5um
id: pm25_sleepingroom
- platform: homeassistant
entity_id: sensor.schlafzimmer_temperatur
id: temp_sleepingroom
- platform: homeassistant
entity_id: sensor.schlafzimmer_luftfeuchtigkeit
id: humid_sleepingroom
- platform: homeassistant
entity_id: sensor.schlafzimmer_co2
id: co2_sleepingroom
- platform: homeassistant
entity_id: sensor.temperatur_aussen
id: temp_outdoor
@ -131,6 +147,15 @@ web_server:
time:
- platform: homeassistant
id: homeassistant_time
on_time:
# Every 5 minutes
- seconds: 0
minutes: /10
then:
- logger.log:
level: INFO
format: 'Timer based screen refresh'
- component.update: epaper
# Font definitions
font:
@ -241,6 +266,10 @@ display:
int livingroom_humid = int(id(humid_livingroom).state);
int livingroom_pm25 = int(id(pm25_livingroom).state);
float livingroom_co2 = id(co2_livingroom).state;
float sleepingroom_temp = id(temp_sleepingroom).state;
int sleepingroom_humid = int(id(humid_sleepingroom).state);
int sleepingroom_pm25 = int(id(pm25_sleepingroom).state);
float sleepingroom_co2 = id(co2_sleepingroom).state;
char sunrise[5] = "";
char sunset[5] = "";
@ -351,52 +380,94 @@ display:
}
/* Livingroom */
int offsetY = 137;
int offsetY = 127;
it.print(10, 10 + offsetY, id(big_sensor_unit), "Wohnzimmer");
it.filled_rectangle(136, 21 + offsetY, 247, 3);
it.print(10, 114 + offsetY, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "PM2.5");
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
it.print(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); // water percent
it.print(10, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰮬"); // co2
it.print(10, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰟤"); // CO2
if(livingroom_temp > -100 && livingroom_temp < 100) {
it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fºC", livingroom_temp);
}else{
}
else {
it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - ºC");
}
if(livingroom_humid >=0 && livingroom_humid <= 100) {
it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%3d%%", livingroom_humid);
}else{
}
else {
it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %");
}
if(livingroom_co2 >=380 && livingroom_co2 <= 20000) {
it.printf(50, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_LEFT , "%4.1fppm", livingroom_co2);
}else{
it.print(50, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_LEFT , " - ppm");
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");
}
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³");
}
if(livingroom_pm25 < 255 && livingroom_pm25 >=0) {
if (livingroom_pm25 > 99){
it.printf(205, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT , "%3d", livingroom_pm25);
it.print(210, 114 + offsetY, id(big_sensor_unit),TextAlign::BASELINE_LEFT, "µg/m³");
}else{
it.printf(175, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT , "%2d", livingroom_pm25);
it.print(180, 114 + offsetY, id(big_sensor_unit),TextAlign::BASELINE_LEFT, "µg/m³");
}
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³");
if(livingroom_pm25 >= pm25_danger_thres) {
it.print(37, 87 + offsetY, id(mdi_med), TextAlign::BASELINE_CENTER, "󰀦"); // warning
it.print(37, 114 + offsetY, id(mdi_med), TextAlign::BASELINE_CENTER, "󰀦"); // warning
}
}
else {
it.print(175, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT , "- ");
it.print(180, 114 + offsetY, id(big_sensor_unit),TextAlign::BASELINE_LEFT, "µg/m³");
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³");
}
/* Sleepingroom */
offsetY = 247;
it.print(10, 10 + offsetY, id(big_sensor_unit), "Schlafzimmer");
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
it.print(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); // water percent
it.print(10, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰟤"); // CO2
if(sleepingroom_temp > -100 && sleepingroom_temp < 100) {
it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fºC", sleepingroom_temp);
}
else {
it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - ºC");
}
if(sleepingroom_humid >=0 && sleepingroom_humid <= 100) {
it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%3d%%", sleepingroom_humid);
}
else {
it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %");
}
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");
}
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³");
}
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³");
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³");
}
/* FOOTER */
it.strftime(610, 374 , id(footer_font), TextAlign::BASELINE_RIGHT , "Aktualisiert um %d.%m.%Y %H:%M", id(homeassistant_time).now());