commit 99b5d87c17bc2b37d3a2c993a0b77b848de622a5 Author: Tim Date: Sun Nov 17 11:48:44 2024 +0100 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8b4157 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Gitignore settings for ESPHome +# This is an example and may include too much for your use-case. +# You can modify this file to suit your needs. +/.esphome/ +/secrets.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a04b218 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.yaml": "home-assistant" + } +} \ No newline at end of file diff --git a/esphome-web-d05329.yaml b/esphome-web-d05329.yaml new file mode 100644 index 0000000..adacd50 --- /dev/null +++ b/esphome-web-d05329.yaml @@ -0,0 +1,128 @@ +esphome: + name: oled-tim + friendly_name: OLED Tim + +esp8266: + board: esp01_1m + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "tY/skPnkQn1sZRBYYJ4LL571z+aA1P463WvaX58ju2w=" + +ota: + platform: esphome + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esphome-Web-D05329" + password: "ZqgvIQnFz4Ib" + +captive_portal: + + +globals: + - id: page + type: int + initial_value: "1" + + +font: + - file: './fonts/OpenSans-Light.ttf' + id: font1 + size: 10 + + - file: './fonts/OpenSans-Light.ttf' + id: font2 + size: 22 + + - file: './fonts/OpenSans-Light.ttf' + id: font3 + size: 14 + +time: + - platform: homeassistant + id: esptime + timezone: Europe/Berlin + +sensor: + - platform: homeassistant + id: tim_zimmer_temp + entity_id: sensor.esphome_web_ebe170_tim_zimmer_temperatur + internal: true + + - platform: homeassistant + id: tim_zimmer_hum + entity_id: sensor.esphome_web_ebe170_tim_zimmer_luftfeuchte + internal: true + + + - platform: homeassistant + id: sollar_power + entity_id: sensor.shellyplus1pm_4855199bbb3c_switch_0_power + internal: true + + - platform: homeassistant + id: gesammtverbrauch + entity_id: sensor.gesamtverbrauch + internal: true + + - platform: homeassistant + id: P1P_Precent + entity_id: sensor.p1p_01s00c343000157_druckfortschritt + internal: true + +text_sensor: + - platform: homeassistant + id: P1P_Status + entity_id: sensor.p1p_01s00c343000157_aktueller_arbeitsschritt + internal: true + + +i2c: + sda: 4 + scl: 5 + scan: True + +display: + - platform: ssd1306_i2c + id: "OLED" + model: "SH1106 128x64" + address: 0x3C + pages: + lambda: |- + // Print time in HH:MM format + it.strftime(0, 0, id(font2), TextAlign::TOP_LEFT, "%H:%M", id(esptime).now()); + + // Print Gesammtverbrauch (from homeassistant sensor) + if (id(gesammtverbrauch).has_state()) { + it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , "%.1fW", id(gesammtverbrauch).state); + } + + // Print inside temperature (from homeassistant sensor) + if (id(tim_zimmer_temp).has_state()) { + it.printf(126, 0, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(tim_zimmer_temp).state); + } + + + // Print Inside Humidity (from homeassistant sensor) + if (id(tim_zimmer_hum).has_state()) { + it.printf(126, 32, id(font3), TextAlign::CENTER_RIGHT , "%.1f%%", id(tim_zimmer_hum).state); + } + + // Print Solar Power (from homeassistant sensor) + if (id(sollar_power).has_state()) { + it.printf(126, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1fW", id(sollar_power).state); + } + + // Print Print Progress (from homeassistant sensor) + if (id(P1P_Status).state == "printing") { + it.printf(0, 37, id(font3), TextAlign::CENTER_LEFT , "%.f%%", id(P1P_Precent).state); + } diff --git a/fonts/Itim-Regular.ttf b/fonts/Itim-Regular.ttf new file mode 100644 index 0000000..153aaeb Binary files /dev/null and b/fonts/Itim-Regular.ttf differ diff --git a/fonts/OpenSans-Bold.ttf b/fonts/OpenSans-Bold.ttf new file mode 100644 index 0000000..98c74e0 Binary files /dev/null and b/fonts/OpenSans-Bold.ttf differ diff --git a/fonts/OpenSans-Light.ttf b/fonts/OpenSans-Light.ttf new file mode 100644 index 0000000..cf8e0c7 Binary files /dev/null and b/fonts/OpenSans-Light.ttf differ diff --git a/fonts/OpenSans-SemiBold.ttf b/fonts/OpenSans-SemiBold.ttf new file mode 100644 index 0000000..a571167 Binary files /dev/null and b/fonts/OpenSans-SemiBold.ttf differ diff --git a/fonts/OpenSans_Condensed-Medium.ttf b/fonts/OpenSans_Condensed-Medium.ttf new file mode 100644 index 0000000..50a9f70 Binary files /dev/null and b/fonts/OpenSans_Condensed-Medium.ttf differ diff --git a/fonts/OpenSans_SemiCondensed-Medium.ttf b/fonts/OpenSans_SemiCondensed-Medium.ttf new file mode 100644 index 0000000..8c143cd Binary files /dev/null and b/fonts/OpenSans_SemiCondensed-Medium.ttf differ diff --git a/fonts/materialdesignicons-webfont.ttf b/fonts/materialdesignicons-webfont.ttf new file mode 100644 index 0000000..bba7dcf Binary files /dev/null and b/fonts/materialdesignicons-webfont.ttf differ diff --git a/test.yaml b/test.yaml new file mode 100644 index 0000000..7127331 --- /dev/null +++ b/test.yaml @@ -0,0 +1,44 @@ +esphome: + name: epaper75 + +esp32: + board: esp32dev + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "tY/skPnkQn1sZRBYYJ4LL571z+aA1P463WvaX58ju2w=" + +ota: + platform: esphome + + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Epaper75 Fallback Hotspot" + password: "FALLBACKPW" + +captive_portal: + + +i2c: + sda: 21 + scl: 22 + scan: True + +sensor: + - platform: aht10 + temperature: + name: "Outside Temperature" + humidity: + name: "Outside Pressure" + update_interval: 60s \ No newline at end of file diff --git a/waveshareTest.yaml b/waveshareTest.yaml new file mode 100644 index 0000000..6ff0156 --- /dev/null +++ b/waveshareTest.yaml @@ -0,0 +1,85 @@ + +esphome: + name: waveshare-test + friendly_name: WaveShare Test + +esp32: + board: esp32dev + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "tY/skPnkQn1sZRBYYJ4LL571z+aA1P463WvaX58ju2w=" + +ota: + platform: esphome + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esphome-Web-D05329" + password: "ZqgvIQnFz4Ib" + +captive_portal: + + +spi: + clk_pin: 13 + mosi_pin: 14 + + + +font: + - file: './fonts/OpenSans-Light.ttf' + id: font10 + size: 10 + + - file: './fonts/OpenSans-Light.ttf' + id: font22 + size: 22 + + - file: './fonts/OpenSans-Light.ttf' + id: font14 + size: 14 + +time: + - platform: homeassistant + id: esptime + timezone: Europe/Berlin + +sensor: + + + + # Externe Wetter Sensoren + - platform: homeassistant + id: windgeschwindigkeit + entity_id: sensor.mering_bauhof_windgeschwindigkeit + internal: true + + +display: + - platform: waveshare_epaper + cs_pin: 15 + dc_pin: 27 + busy_pin: 25 + reset_pin: 26 + model: 7.50inv2 + update_interval: 60s + lambda: |- + + + //Time + it.strftime(540, 100, id(font22),TextAlign::BOTTOM_LEFT, "%H:%M", id(esptime).now()); + it.strftime(540, 110, id(font14),TextAlign::BOTTOM_LEFT, "%A, %d.%m.%y, KW %W", id(esptime).now()); + + + diff --git a/waveshareTest2.yaml b/waveshareTest2.yaml new file mode 100644 index 0000000..eb57f86 --- /dev/null +++ b/waveshareTest2.yaml @@ -0,0 +1,319 @@ +esphome: + name: epaper75 + +esp32: + board: esp32dev + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "tY/skPnkQn1sZRBYYJ4LL571z+aA1P463WvaX58ju2w=" + +ota: + platform: esphome + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Epaper75 Fallback Hotspot" + password: "FALLBACKPW" + +captive_portal: + + +# Example configuration entry +spi: + clk_pin: 13 + mosi_pin: 14 + +# --- Fonts -------------------------------------------------------------------- +font: + - file: 'fonts/OpenSans-Bold.ttf' + id: openSansBold_font + 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', 'å', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', '/', '€', '’', 'ß'] + + - file: 'fonts/OpenSans-Bold.ttf' + id: watch_font + size: 90 + glyphs: + [':', ".", '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + + # https://pictogrammers.github.io/@mdi/font/6.5.95/ Unicodes + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_25 + size: 25 + glyphs: [ + "\U000F050F", # mdi-thermometer + "\U000F0F55", # mdi-home-thermometer-outline + "\U000F0F54", # mdi-home-thermometer + "\U000F058E", # mdi-water-percent + "\U000F029A", # mdi-gauge + "\U000F059B", # mdi-weather-sunset + "\U000F059C", # mdi-weather-sunrise + "\U000F10C2", # mdi-thermometer-high + "\U000F10C3" # mdi-thermometer-low + ] + + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_32 + size: 32 + glyphs: [ + "\U000F091F", # mdi-wifi-strength-1 + "\U000F0922", # mdi-wifi-strength-2 + "\U000F0925", # mdi-wifi-strength-3 + "\U000F0928", # mdi-wifi-strength-4 + "\U000F092B", # mdi-wifi-strength-alert-outline + + "\U000F0590", # weather-cloudy + "\U000F0F2F", # weather-cloudy-alert + "\U000F0E6E", # weather-cloudy-arrow-right + "\U000F0591", # weather-fog + "\U000F0592", # weather-hail + "\U000F0F30", # weather-hazy + "\U000F0898", # weather-hurricane + "\U000F0593", # weather-lightning + "\U000F067E", # weather-lightning-rainy + "\U000F0594", # weather-night + "\U000F0F31", # weather-night-partly-cloudy + "\U000F0595", # weather-partly-cloudy + "\U000F0F32", # weather-partly-lightning + "\U000F0F33", # weather-partly-rainy + "\U000F0F34", # weather-partly-snowy + "\U000F0F35", # weather-partly-snowy-rainy + "\U000F0596", # weather-pouring + "\U000F0597", # weather-rainy + "\U000F0598", # weather-snowy + "\U000F0F36", # weather-snowy-heavy + "\U000F067F", # weather-snowy-rainy + "\U000F0599", # weather-sunny + "\U000F0F37", # weather-sunny-alert + "\U000F14E4", # weather-sunny-off + "\U000F059A", # weather-sunset + "\U000F059B", # weather-sunset-down + "\U000F059C", # weather-sunset-up + "\U000F0F38", # weather-tornado + "\U000F059D", # weather-windy + "\U000F059E" # weather-windy-variant + ] + + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_50 + size: 80 + glyphs: [ + "\U000F0590", # weather-cloudy + "\U000F0F2F", # weather-cloudy-alert + "\U000F0E6E", # weather-cloudy-arrow-right + "\U000F0591", # weather-fog + "\U000F0592", # weather-hail + "\U000F0F30", # weather-hazy + "\U000F0898", # weather-hurricane + "\U000F0593", # weather-lightning + "\U000F067E", # weather-lightning-rainy + "\U000F0594", # weather-night + "\U000F0F31", # weather-night-partly-cloudy + "\U000F0595", # weather-partly-cloudy + "\U000F0F32", # weather-partly-lightning + "\U000F0F33", # weather-partly-rainy + "\U000F0F34", # weather-partly-snowy + "\U000F0F35", # weather-partly-snowy-rainy + "\U000F0596", # weather-pouring + "\U000F0597", # weather-rainy + "\U000F0598", # weather-snowy + "\U000F0F36", # weather-snowy-heavy + "\U000F067F", # weather-snowy-rainy + "\U000F0599", # weather-sunny + "\U000F0F37", # weather-sunny-alert + "\U000F14E4", # weather-sunny-off + "\U000F059A", # weather-sunset + "\U000F059B", # weather-sunset-down + "\U000F059C", # weather-sunset-up + "\U000F0F38", # weather-tornado + "\U000F059D", # weather-windy + "\U000F059E" # weather-windy-variant + ] + + +# --- Display Layout ----------------------------------------------------------- +display: + - platform: waveshare_epaper + cs_pin: 15 + dc_pin: 27 + busy_pin: 25 + reset_pin: 26 + model: 7.50inv2 + update_interval: 60s + lambda: | + int x, y; + + // Grid + it.line(0, 108, 800, 108); // Horizontal header + it.line(0, 440, 800, 440); // Horizontal footer + it.line(266, 108, 266, 440); // Vertical first line + it.line(532, 108, 532, 440); // Vertical second line + + + + // Temperature inside / outside + it.printf(100, 35, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0F54"); + //it.printf(130, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s °C", id(tim_zimmer_temp).state.c_str()); // use your own temp sensor + + it.printf(100, 65, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0F55"); + //it.printf(130, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s °C", id(tim_zimmer_hum).state.c_str());// use your own temp sensor + + //Time + it.strftime(540, 100, id(watch_font),TextAlign::BOTTOM_LEFT, "%H:%M", id(time_homeassistant).now()); + it.strftime(540, 110, id(openSansBold_font),TextAlign::BOTTOM_LEFT, "%A, %d.%m.%y, KW %W", id(time_homeassistant).now()); + + // Current weather + // https://www.home-assistant.io/integrations/weather/ + // weahtericon;temperature;humidity,pressure;wind_speed + // ex. data: cloudy;5,9;50;1025,6;16,9 + + std::map weatherMap = { + std::make_pair("exceptional","\U000F0F2F"), + std::make_pair("cloudy","\U000F0590"), + std::make_pair("cloudy-alert","\U000F0F2F"), + std::make_pair("fog","\U000F0591"), + std::make_pair( "hail","\U000F0592"), + std::make_pair( "hazy","\U000F0F30"), + std::make_pair( "hurricane","\U000F0898"), + std::make_pair( "lightning","\U000F0593"), + std::make_pair( "lightning-rainy","\U000F067E"), + std::make_pair( "night","\U000F0594"), + std::make_pair( "clear-night","\U000F0594"), + std::make_pair( "night-partly-cloudy","\U000F0F31"), + std::make_pair( "partly-cloudy","\U000F0595"), + std::make_pair( "partlycloudy","\U000F0595"), + std::make_pair( "partly-lightning","\U000F0F32"), + std::make_pair( "partly-rainy","\U000F0F33"), + std::make_pair( "partly-snowy","\U000F0F34"), + std::make_pair( "partly-snowy-rainy","\U000F0F35"), + std::make_pair( "pouring","\U000F0596"), + std::make_pair( "rainy","\U000F0597"), + std::make_pair( "snowy","\U000F0598"), + std::make_pair( "snowy-heavy","\U000F0F36"), + std::make_pair( "snowy-rainy","\U000F067F"), + std::make_pair( "sunny","\U000F0599"), + std::make_pair( "sunny-alert","\U000F0F37"), + std::make_pair( "sunny-off","\U000F14E4"), + std::make_pair( "tornado","\U000F0F38"), + std::make_pair( "windy","\U000F059D"), + std::make_pair( "windy-variant","\U000F059E")}; + + + // -- Footer --- + //IP Adress + if (id(ip_address).has_state()) { + it.printf(5, 470, id(openSansBold_font), TextAlign::BASELINE_LEFT, "IP: %s", id(ip_address).state.c_str()); + } + + // WiFi Signal Strength + if(id(wifisignal).has_state()) { + x = 210, y = 475; + if (id(wifisignal).state >= -50) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0928"); + ESP_LOGI("WiFi", "Exellent"); + } else if (id(wifisignal).state >= -60) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0925"); + ESP_LOGI("WiFi", "Good"); + } else if (id(wifisignal).state >= -67) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0922"); + ESP_LOGI("WiFi", "Fair"); + } else if (id(wifisignal).state >= -70) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F091F"); + ESP_LOGI("WiFi", "Weak"); + } else { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F092B"); + ESP_LOGI("WiFi", "Unlikely"); + } + } + + // ESP Home UpTime + if (id(uptime_human).has_state()) { + it.printf(520, 470, id(openSansBold_font), TextAlign::BASELINE_LEFT, "UpTime: %s", id(uptime_human).state.c_str()); + } + + + + + +# --- Sensors ------------------------------------------------------------------ +sensor: + + # ESP Home UpTime + - platform: uptime + id: uptime_sensor + update_interval: 60s + on_raw_value: + then: + - text_sensor.template.publish: + id: uptime_human + state: !lambda |- + int seconds = round(id(uptime_sensor).raw_state); + int days = seconds / (24 * 3600); + seconds = seconds % (24 * 3600); + int hours = seconds / 3600; + seconds = seconds % 3600; + int minutes = seconds / 60; + seconds = seconds % 60; + return ( + (days ? String(days) + ":" : "000:") + + (hours ? String(hours) + ":" : "00:") + + (minutes ? String(minutes) + ":" : "00:") + + (String(seconds) + "") + ).c_str(); + - platform: wifi_signal + id: wifisignal + update_interval: 60s + + - platform: homeassistant + id: tim_zimmer_temp + entity_id: sensor.esphome_web_ebe170_tim_zimmer_temperatur + internal: true + + - platform: homeassistant + id: tim_zimmer_hum + entity_id: sensor.esphome_web_ebe170_tim_zimmer_luftfeuchte + internal: true + + + - platform: homeassistant + id: sollar_power + entity_id: sensor.shellyplus1pm_4855199bbb3c_switch_0_power + internal: true + + - platform: homeassistant + id: gesammtverbrauch + entity_id: sensor.gesamtverbrauch + internal: true + +text_sensor: + # ESP WLAN IP Address + - platform: wifi_info + ip_address: + name: "${name} IP Address" + id: ip_address + # ESP Home UpTime + - platform: template + id: uptime_human + icon: mdi:clock-start + + +time: + - platform: homeassistant + id: time_homeassistant \ No newline at end of file diff --git a/wavesharetest3.yaml b/wavesharetest3.yaml new file mode 100644 index 0000000..962d483 --- /dev/null +++ b/wavesharetest3.yaml @@ -0,0 +1,413 @@ +esphome: + name: epaper75 + +esp32: + board: esp32dev + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "tY/skPnkQn1sZRBYYJ4LL571z+aA1P463WvaX58ju2w=" + +ota: + platform: esphome + + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Epaper75 Fallback Hotspot" + password: "FALLBACKPW" + +captive_portal: + + +# Example configuration entry +spi: + clk_pin: 13 + mosi_pin: 14 + +i2c: + sda: 21 + scl: 22 + scan: True + + + +# --- Fonts -------------------------------------------------------------------- +font: + - file: 'fonts/OpenSans-Bold.ttf' + id: openSansBold_font + 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', 'å', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', '/', '€', '’', 'ß'] + + - file: 'fonts/OpenSans-Bold.ttf' + id: watch_font + size: 90 + glyphs: + [':', ".", '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + + # https://pictogrammers.github.io/@mdi/font/6.5.95/ Unicodes + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_25 + size: 25 + glyphs: [ + "\U000F050F", # mdi-thermometer + "\U000F0F55", # mdi-home-thermometer-outline + "\U000F0F54", # mdi-home-thermometer + "\U000F058E", # mdi-water-percent + "\U000F029A", # mdi-gauge + "\U000F059B", # mdi-weather-sunset + "\U000F059C", # mdi-weather-sunrise + "\U000F10C2", # mdi-thermometer-high + "\U000F10C3", # mdi-thermometer-low + "\U000F192D", # mid-transmission-tower-import + "\U000F0D9C", # mdi-solar-pannel-larg + "\U000F19A5" # mdi-solar-compas + ] + + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_32 + size: 32 + glyphs: [ + "\U000F091F", # mdi-wifi-strength-1 + "\U000F0922", # mdi-wifi-strength-2 + "\U000F0925", # mdi-wifi-strength-3 + "\U000F0928", # mdi-wifi-strength-4 + "\U000F092B", # mdi-wifi-strength-alert-outline + + "\U000F0590", # weather-cloudy + "\U000F0F2F", # weather-cloudy-alert + "\U000F0E6E", # weather-cloudy-arrow-right + "\U000F0591", # weather-fog + "\U000F0592", # weather-hail + "\U000F0F30", # weather-hazy + "\U000F0898", # weather-hurricane + "\U000F0593", # weather-lightning + "\U000F067E", # weather-lightning-rainy + "\U000F0594", # weather-night + "\U000F0F31", # weather-night-partly-cloudy + "\U000F0595", # weather-partly-cloudy + "\U000F0F32", # weather-partly-lightning + "\U000F0F33", # weather-partly-rainy + "\U000F0F34", # weather-partly-snowy + "\U000F0F35", # weather-partly-snowy-rainy + "\U000F0596", # weather-pouring + "\U000F0597", # weather-rainy + "\U000F0598", # weather-snowy + "\U000F0F36", # weather-snowy-heavy + "\U000F067F", # weather-snowy-rainy + "\U000F0599", # weather-sunny + "\U000F0F37", # weather-sunny-alert + "\U000F14E4", # weather-sunny-off + "\U000F059A", # weather-sunset + "\U000F059B", # weather-sunset-down + "\U000F059C", # weather-sunset-up + "\U000F0F38", # weather-tornado + "\U000F059D", # weather-windy + "\U000F059E" # weather-windy-variant + ] + + - file: 'fonts/materialdesignicons-webfont.ttf' + id: materialdesign_icons_50 + size: 80 + glyphs: [ + "\U000F0590", # weather-cloudy + "\U000F0F2F", # weather-cloudy-alert + "\U000F0E6E", # weather-cloudy-arrow-right + "\U000F0591", # weather-fog + "\U000F0592", # weather-hail + "\U000F0F30", # weather-hazy + "\U000F0898", # weather-hurricane + "\U000F0593", # weather-lightning + "\U000F067E", # weather-lightning-rainy + "\U000F0594", # weather-night + "\U000F0F31", # weather-night-partly-cloudy + "\U000F0595", # weather-partly-cloudy + "\U000F0F32", # weather-partly-lightning + "\U000F0F33", # weather-partly-rainy + "\U000F0F34", # weather-partly-snowy + "\U000F0F35", # weather-partly-snowy-rainy + "\U000F0596", # weather-pouring + "\U000F0597", # weather-rainy + "\U000F0598", # weather-snowy + "\U000F0F36", # weather-snowy-heavy + "\U000F067F", # weather-snowy-rainy + "\U000F0599", # weather-sunny + "\U000F0F37", # weather-sunny-alert + "\U000F14E4", # weather-sunny-off + "\U000F059A", # weather-sunset + "\U000F059B", # weather-sunset-down + "\U000F059C", # weather-sunset-up + "\U000F0F38", # weather-tornado + "\U000F059D", # weather-windy + "\U000F059E" # weather-windy-variant + ] + + +# --- Display Layout ----------------------------------------------------------- +display: + - platform: waveshare_epaper + cs_pin: 15 + dc_pin: 27 + busy_pin: 25 + reset_pin: 26 + model: 7.50inv2 + update_interval: 60s + lambda: | + int x, y; + + // Grid + it.line(0, 108, 800, 108); // Horizontal header + it.line(0, 440, 800, 440); // Horizontal footer + it.line(266, 108, 266, 440); // Vertical first line + + + + // Sunrise / Sunset + it.printf(30, 40, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059C"); + it.printf(70, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunrise).state.c_str()); + + it.printf(30, 70, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059B"); + it.printf(70, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunset).state.c_str()); + + // Temperature inside / outside + it.printf(135, 40, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0F54"); + it.printf(165, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%.1f °C", id(inside_temperatur).state); // use your own temp sensor + + it.printf(135, 65, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F029A"); + it.printf(165, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%.1f %%", id(inside_humidity).state);// use your own temp sensor + + //Time + it.strftime(530, 100, id(watch_font),TextAlign::BOTTOM_LEFT, "%H:%M", id(time_homeassistant).now()); + it.strftime(520, 110, id(openSansBold_font),TextAlign::BOTTOM_LEFT, "%A, %d.%m.%y, KW %W", id(time_homeassistant).now()); + + // Current weather + // https://www.home-assistant.io/integrations/weather/ + // weahtericon;temperature;humidity,pressure;wind_speed + // ex. data: cloudy;5,9;50;1025,6;16,9 + + std::map weatherMap = { + std::make_pair("exceptional","\U000F0F2F"), + std::make_pair("cloudy","\U000F0590"), + std::make_pair("cloudy-alert","\U000F0F2F"), + std::make_pair("fog","\U000F0591"), + std::make_pair( "hail","\U000F0592"), + std::make_pair( "hazy","\U000F0F30"), + std::make_pair( "hurricane","\U000F0898"), + std::make_pair( "lightning","\U000F0593"), + std::make_pair( "lightning-rainy","\U000F067E"), + std::make_pair( "night","\U000F0594"), + std::make_pair( "clear-night","\U000F0594"), + std::make_pair( "night-partly-cloudy","\U000F0F31"), + std::make_pair( "partly-cloudy","\U000F0595"), + std::make_pair( "partlycloudy","\U000F0595"), + std::make_pair( "partly-lightning","\U000F0F32"), + std::make_pair( "partly-rainy","\U000F0F33"), + std::make_pair( "partly-snowy","\U000F0F34"), + std::make_pair( "partly-snowy-rainy","\U000F0F35"), + std::make_pair( "pouring","\U000F0596"), + std::make_pair( "rainy","\U000F0597"), + std::make_pair( "snowy","\U000F0598"), + std::make_pair( "snowy-heavy","\U000F0F36"), + std::make_pair( "snowy-rainy","\U000F067F"), + std::make_pair( "sunny","\U000F0599"), + std::make_pair( "sunny-alert","\U000F0F37"), + std::make_pair( "sunny-off","\U000F14E4"), + std::make_pair( "tornado","\U000F0F38"), + std::make_pair( "windy","\U000F059D"), + std::make_pair( "windy-variant","\U000F059E")}; + + if(id(epaper_weather_actual).has_state()) { + std::string actualWeatherCSV = id(epaper_weather_actual).state; //("cloudy;5,9;50;1025,6;16,9"); + ESP_LOGI("Weather today", "%s", actualWeatherCSV.c_str()); + std::size_t current, previous = 0; + char delim = ';'; + current = actualWeatherCSV.find(delim); + x = 30; y = 200; + for (int i=0; i<5; i++) { + const char * value = actualWeatherCSV.substr(previous, current - previous).c_str(); + if(i == 0) { // icon + std::string unicodeWeatherIcon = weatherMap.at(value); + it.printf(x , y, id(materialdesign_icons_50), TextAlign::BASELINE_LEFT, unicodeWeatherIcon.c_str()); + y = 120; + x = x + 90; + } else if (i == 1) { // temperature + it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s °C", value); + } else if (i == 2) { // humidity + it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s %s", value, "%"); + } else if (i == 3) { // pressure + it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s hPa", value); + } else if (i == 4) { // windpeed + it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s km/h", value); + } + y += 25; + previous = current + 1; + current = actualWeatherCSV.find(delim, previous); + } + } + + it.printf(35, 300, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F192D"); + it.printf(75, 300, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%.1f W", id(gesammtverbrauch).state); + + it.printf(35, 330, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0D9C"); + it.printf(75, 330, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%.1f W", id(sollar_power).state); + it.print(160, 327, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "___"); + + it.printf(35, 360, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F19A5"); + it.printf(75, 360, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%.1f W", id(solar_forcast_now).state); + it.print(160, 359, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "----"); + + it.graph(266, 108, id(power_graph)); + + + + // -- Footer --- + //IP Adress + if (id(ip_address).has_state()) { + it.printf(25, 470, id(openSansBold_font), TextAlign::BASELINE_LEFT, "IP: %s", id(ip_address).state.c_str()); + } + + // WiFi Signal Strength + if(id(wifisignal).has_state()) { + x = 235, y = 475; + if (id(wifisignal).state >= -50) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0928"); + ESP_LOGI("WiFi", "Exellent"); + } else if (id(wifisignal).state >= -60) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0925"); + ESP_LOGI("WiFi", "Good"); + } else if (id(wifisignal).state >= -67) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F0922"); + ESP_LOGI("WiFi", "Fair"); + } else if (id(wifisignal).state >= -70) { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F091F"); + ESP_LOGI("WiFi", "Weak"); + } else { + it.print(x, y, id(materialdesign_icons_32), TextAlign::BOTTOM_RIGHT, "\U000F092B"); + ESP_LOGI("WiFi", "Unlikely"); + } + } + + // ESP Home UpTime + if (id(uptime_human).has_state()) { + it.printf(570, 470, id(openSansBold_font), TextAlign::BASELINE_LEFT, "UpTime: %s", id(uptime_human).state.c_str()); + } + + + + + +# --- Sensors ------------------------------------------------------------------ +sensor: + # ESP Home UpTime + - platform: uptime + id: uptime_sensor + update_interval: 60s + on_raw_value: + then: + - text_sensor.template.publish: + id: uptime_human + state: !lambda |- + int seconds = round(id(uptime_sensor).raw_state); + int days = seconds / (24 * 3600); + seconds = seconds % (24 * 3600); + int hours = seconds / 3600; + seconds = seconds % 3600; + int minutes = seconds / 60; + seconds = seconds % 60; + return ( + (days ? String(days) + ":" : "000:") + + (hours ? String(hours) + ":" : "00:") + + (minutes ? String(minutes) + ":" : "00:") + + (String(seconds) + "") + ).c_str(); + - platform: wifi_signal + id: wifisignal + update_interval: 60s + + - platform: aht10 + temperature: + id: "inside_temperatur" + name: "Temperatur" + humidity: + id: "inside_humidity" + name: "Luftfeuchte" + update_interval: 30s + + + - platform: homeassistant + id: solar_forcast_now + entity_id: sensor.power_production_now + internal: true + + - platform: homeassistant + id: sollar_power + entity_id: sensor.shellyplus1pm_4855199bbb3c_switch_0_power + internal: true + + - platform: homeassistant + id: gesammtverbrauch + entity_id: sensor.gesamtverbrauch + internal: true + +text_sensor: + # ESP WLAN IP Address + - platform: wifi_info + ip_address: + name: "${name} IP Address" + id: ip_address + + # ESP Home UpTime + - platform: template + id: uptime_human + icon: mdi:clock-start + + # Weather forecast + - platform: homeassistant + id: epaper_weather_actual + entity_id: sensor.epaper_weather_actual + internal: true + + - platform: homeassistant + id: epaper_sunrise + entity_id: sensor.epaper_sunrise + internal: true + + - platform: homeassistant + id: epaper_sunset + entity_id: sensor.epaper_sunset + internal: true + +time: + - platform: homeassistant + id: time_homeassistant + +graph: + - id: power_graph + duration: 24h + x_grid: 4h + width: 515 + height: 333 + traces: + - sensor: sollar_power + line_type: SOLID + line_thickness: 5 + - sensor: solar_forcast_now + line_type: DASHED + line_thickness: 5 +