diff --git a/esphome/epaperframe.yaml b/esphome/epaperframe.yaml index 743b5e1..03c8d17 100644 --- a/esphome/epaperframe.yaml +++ b/esphome/epaperframe.yaml @@ -135,6 +135,10 @@ text_sensor: entity_id: sensor.moon id: moonphase + - platform: homeassistant + entity_id: weather.zuhause + id: weather + # Webserver configuration web_server: port: 80 @@ -213,7 +217,13 @@ font: '󰊚', # mdi-gauge (air pressure) '󰖙', # mdi-weather-sunny '󰖛', # mdi-weather-sunset-down - '󰖜', # mdi-weather-sunset-up + '󰖜' # mdi-weather-sunset-up + ] + + - file: 'fonts/materialdesignicons-webfont.ttf' + id: mdi_weather + size: 80 + glyphs: [ '󰽡', # mdi-moon-first-quarter '󰽢', # mdi-moon-full '󰽣', # mdi-moon-last-quarter @@ -221,7 +231,22 @@ font: '󰽥', # mdi-moon-waning-crescent '󰽦', # mdi-moon-waning-gibbous '󰽧', # mdi-moon-waxing-crescent - '󰽨' # mdi-moon-waxing-gibbous + '󰽨', # mdi-moon-waxing-gibbous + '󰖔', # mdi-weather-night + '󰖐', # mdi-weather-cloudy + '󰖑', # mdi-weather-fog + '󰖒', # mdi-weather-hail + '󰖓', # mdi-weather-lightning + '󰙾', # mdi-weather-lightning-rainy + '󰖕', # mdi-weather-partly-cloudy + '󰖖', # mdi-weather-pouring + '󰖗', # mdi-weather-rainy + '󰖘', # mdi-weather-snowy + '󰙿', # mdi-weather-snowy-rainy + '󰖙', # mdi-weather-sunny + '󰖝', # mdi-weather-windy + '󰖞', # mdi-weather-windy-variant + '󰳥' # mdi-weather-exceptional ] - file: 'fonts/materialdesignicons-webfont.ttf' @@ -308,16 +333,8 @@ display: a width of 305 and a height of 3 */ it.filled_rectangle(86, 21, 297, 3); - 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); - it.print(10, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); // sun-up - 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(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset); - } - it.print(250, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰊚"); // air pressure icon + it.print(10, 115, id(mdi_small), TextAlign::BASELINE_LEFT, "󰊚"); // air pressure icon it.print(375, 75, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer icon it.print(375, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); // water percent icon @@ -335,55 +352,15 @@ display: it.print(357, 115, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %"); } - if(air_pressure < 1200 && air_pressure >=800) { // Has valid value - it.printf(228, 115, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%4.1fhPa", air_pressure); - } - else { // Invalid or error value - it.print(228, 115, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "- hPa"); + if(air_pressure < 1200 && air_pressure >=800) { + it.printf(220, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%4.1f", air_pressure); + it.print(225, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "hPa"); } + else { + it.print(220, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- "); + it.print(225, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "hPa"); + } - /* Moon phase display */ - if(id(moonphase).has_state()) { - int x = 10; - int y = 116; - if (id(moonphase).state == "new_moon") { - // new moon - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽤"); - ESP_LOGI("Moonphase", "new moon"); - } else if (id(moonphase).state == "waxing_crescent") { - // waxing crescent - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽧"); - ESP_LOGI("Moonphase", "waxing crescent"); - } else if (id(moonphase).state == "first_quarter") { - // first_quarter - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽡"); - ESP_LOGI("Moonphase", "first quarter"); - } else if (id(moonphase).state == "waxing_gibbous") { - // waxing gibbous - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽨"); - ESP_LOGI("Moonphase", "waxing gibbous"); - } else if (id(moonphase).state == "full_moon") { - // full moon - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽢"); - ESP_LOGI("Moonphase", "full moon"); - } else if (id(moonphase).state == "waning_gibbous") { - // waning gibbous - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽦"); - ESP_LOGI("Moonphase", "waning gibbous"); - } else if (id(moonphase).state == "last_quarter") { - // last quarter - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽣"); - ESP_LOGI("Moonphase", "last quarter"); - } else if (id(moonphase).state == "waning_crescent") { - // waning crescent - it.print(x, y, id(mdi_small), TextAlign::BASELINE_LEFT, "󰽥"); - ESP_LOGI("Moonphase", "waning crescent"); - } else { - // N/A - it.print(x, y, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "-"); - ESP_LOGE("Moonphase", "No data"); - } - } /* Livingroom */ offsetY = 127; @@ -428,7 +405,8 @@ display: else { it.print(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- "); it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³"); - } + } + /* Sleepingroom */ offsetY = 247; @@ -480,6 +458,129 @@ display: it.print(10 + offsetX, 10, id(sensor_unit), "Wetter"); it.filled_rectangle(80 + offsetX, 21, 155, 3); + /* Current weather */ + if(id(weather).has_state()) { + int x = 227 + offsetX; + int y = 116; + if (id(weather).state == "clear-night") { + // clear night + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖔"); + ESP_LOGI("Weather", "clear night"); + } else if (id(weather).state == "cloudy") { + // cloudy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖐"); + ESP_LOGI("Weather", "cloudy"); + } else if (id(weather).state == "fog") { + // fog + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖑"); + ESP_LOGI("Weather", "fog"); + } else if (id(weather).state == "hail") { + // hail + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖒"); + ESP_LOGI("Weather", "hail"); + } else if (id(weather).state == "lightning") { + // lightning + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖓"); + ESP_LOGI("Weather", "lightning"); + } else if (id(weather).state == "lightning-rainy") { + // lightning-rainy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰙾"); + ESP_LOGI("Weather", "lightning-rainy"); + } else if (id(weather).state == "partlycloudy") { + // partly cloudy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖕"); + ESP_LOGI("Weather", "partlycloudy"); + } else if (id(weather).state == "pouring") { + // pouring + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖖"); + ESP_LOGI("Weather", "pouring"); + } else if (id(weather).state == "rainy") { + // rainy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖗"); + ESP_LOGI("Weather", "rainy"); + } else if (id(weather).state == "snowy") { + // snowy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖘"); + ESP_LOGI("Weather", "snowy"); + } else if (id(weather).state == "snowy-rainy") { + // snowy-rainy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰙿"); + ESP_LOGI("Weather", "snowy-rainy"); + } else if (id(weather).state == "sunny") { + // sunny + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖙"); + ESP_LOGI("Weather", "sunny"); + } else if (id(weather).state == "windy") { + // windy + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖝"); + ESP_LOGI("Weather", "windy"); + } else if (id(weather).state == "windy-variant") { + // windy variant + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰖞"); + ESP_LOGI("Weather", "windy variant"); + } else if (id(weather).state == "exceptional") { + // exceptional + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_RIGHT, "󰳥"); + ESP_LOGI("Weather", "exceptional"); + } else { + // N/A + it.print(x, y, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "-"); + ESP_LOGE("Weather", "No data"); + } + } + + /* Moon phase display */ + if(id(moonphase).has_state()) { + int x = 10 + offsetX; + int y = 200; + if (id(moonphase).state == "new_moon") { + // new moon + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽤"); + ESP_LOGI("Moonphase", "new moon"); + } else if (id(moonphase).state == "waxing_crescent") { + // waxing crescent + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽧"); + ESP_LOGI("Moonphase", "waxing crescent"); + } else if (id(moonphase).state == "first_quarter") { + // first_quarter + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽡"); + ESP_LOGI("Moonphase", "first quarter"); + } else if (id(moonphase).state == "waxing_gibbous") { + // waxing gibbous + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽨"); + ESP_LOGI("Moonphase", "waxing gibbous"); + } else if (id(moonphase).state == "full_moon") { + // full moon + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽢"); + ESP_LOGI("Moonphase", "full moon"); + } else if (id(moonphase).state == "waning_gibbous") { + // waning gibbous + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽦"); + ESP_LOGI("Moonphase", "waning gibbous"); + } else if (id(moonphase).state == "last_quarter") { + // last quarter + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽣"); + ESP_LOGI("Moonphase", "last quarter"); + } else if (id(moonphase).state == "waning_crescent") { + // waning crescent + it.print(x, y, id(mdi_weather), TextAlign::BASELINE_LEFT, "󰽥"); + ESP_LOGI("Moonphase", "waning crescent"); + } else { + // N/A + it.print(x, y, id(big_sensor_font), TextAlign::BASELINE_LEFT, "-"); + ESP_LOGE("Moonphase", "No data"); + } + } + + 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); + + 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", sunrise); + it.print(135 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖛"); // sun-down + it.printf(175 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset); + } /* Serverroom */ offsetY = 247; @@ -503,6 +604,7 @@ display: it.print(207 + offsetX, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %"); } + /* FOOTER */ it.strftime(614, 380, id(footer_font), TextAlign::BASELINE_RIGHT , "Aktualisiert um %d.%m.%Y %H:%M", id(homeassistant_time).now());