From 7f12efa1ba68ce598d3b463fde2375ecd8233497 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Sat, 9 Apr 2022 23:55:48 +0200 Subject: [PATCH] Added Sleepingroom power sensor(s). --- esphome/epaperframe.yaml | 58 +++++++++++++--------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/esphome/epaperframe.yaml b/esphome/epaperframe.yaml index aa78123..a3df55c 100644 --- a/esphome/epaperframe.yaml +++ b/esphome/epaperframe.yaml @@ -168,6 +168,14 @@ sensor: entity_id: sensor.wohnzimmer_heimkino_power id: media_livingroom + - platform: homeassistant + entity_id: sensor.schlafzimmer_bett_power + id: bedlight_sleepingroom + + - platform: homeassistant + entity_id: sensor.schlafzimmer_heimkino_power + id: media_sleepingroom + text_sensor: - platform: homeassistant name: "Sun Rising ESP" @@ -643,10 +651,6 @@ display: it.print(80 + offsetX, 200, id(big_sensor_font), TextAlign::BASELINE_LEFT, "Lüften!"); } - /* ESP_LOGI("Sunrise: %s, Sunset: %s", - id(sun_rising).state.c_str(), id(sun_setting).state.c_str()); - */ - it.print(10 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); // sun-up it.printf(50 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_rising).state.c_str()); it.print(135 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖛"); // sun-down @@ -703,6 +707,7 @@ display: float serverroom_power = id(power_serverroom).state; float livingroom_desk = id(desk_livingroom).state; float livingroom_media = id(media_livingroom).state; + float sleepingroom = id(media_sleepingroom).state + id(bedlight_sleepingroom).state; int offsetX = 0; int offsetY = 0; @@ -725,15 +730,17 @@ display: it.print(375, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug it.print(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug + it.print(20, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "Schreibtisch"); if(livingroom_desk >= 0) { - it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fW", livingroom_desk); + it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1f W", livingroom_desk); } else { it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - W"); } + it.print(20, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "Heimkino"); if(livingroom_media >= 0) { - it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fW", livingroom_media); + it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1f W", livingroom_media); } else { it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - W"); @@ -743,46 +750,17 @@ display: offsetY = 247; 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 - 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(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug - if(sleepingroom_temp > -100 && sleepingroom_temp < 100) { - it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fºC", sleepingroom_temp); + // it.print(20, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "Heimkino"); + if(sleepingroom >= 0) { + it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1f W", sleepingroom); } else { - it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - ºC"); + it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - W"); } - 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(170, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%4.0f", sleepingroom_co2); - it.print(175, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm"); - } - else { - it.print(170, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- "); - it.print(175, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm³"); - } - - if(sleepingroom_pm25 < 255 && sleepingroom_pm25 >=0) { - it.printf(220, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%3d", sleepingroom_pm25); - it.print(225, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³"); - } - else { - it.print(220, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- "); - it.print(225, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³"); - } - */ - /* LINEPOWER */ offsetX = 390; offsetY = 65;