Sensoren mit ESPhome auf epaper anzeigen

Installation, Konfiguration


Antworten
SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Hallo erstmal,
da dies Forum hier ja offensichtlich ratsuchenden "Dummies" behilflich sein soll, habe ich hier eine, für mich, grundsätzliche Frage:
Ich habe ein Waveshare 7.5"V2-Display mit dem entsprechenden ESP32-Driver-Board. Mit viel "Trial & Error" habe ich es auch zum Laufen gebracht. Mir werden Uhrzeit und Wetterdaten angezeigt. Nun möchte ich das aber erweitern. Dabei bin ich auf die Möglichkeit gestoßen, aktuelle Benzinpreise anzeigen zu lassen. Im Home Assistent habe ich es soweit eingerichtet, dass mir diese Daten (von Tankerkoenig) in der Karte angezeigt werden. In den Entwicklerwerkzeugen werden mir die Daten als Zustände mit "sensor.xxx_super_e10" angezeigt. Was muss ich anstellen, um eine entsprechende Anzeige auf dem epaper-Display zu erreichen (Einträge in der"Display".yaml, Configuration.yaml)? Ich bin hier wirklich ein absoluter "Dummie" und würde mich freuen, wenn ich mit Eurer Hilfe verstehen lernen kann, welche Schritte erforderlich sind ...

Benutzeravatar
Osorkon
Administrator
Beiträge: 1951
Registriert: Sa 17. Jul 2021, 16:53
2
Wohnort: Langenargen
Has thanked: 61 times
Been thanked: 530 times
Kontaktdaten:

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Osorkon »

Hallo @SmarTiger und Herzlich Willkommen bei den SmartHome for Dummies. :D :D

Kannst mal Deinen ESPHome Konfiguration posten.
Da wäre denke ich nur der display: bereich interessant.

Habe selbst die letzten Tage ein wenig mit ESPHome und einen LCD Sreen rumgespielt.
Vielleicht kann ich Dich zumindest in die richtige Richtung schuppsen.

Gruß
Osorkon

Einer muss ja für Ordnung sorgen. :D
SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Das "ESP.yaml"
sieht (ab Display) so aus:

Code: Alles auswählen

# --- 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

// Sunrise / Sunset it.printf(5, 40, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059C"); it.printf(35, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunrise).state.c_str());
it.printf(5, 70, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059B"); it.printf(35, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunset).state.c_str());
// HIER möchte ich die Benzinpreise anzeigen it.printf(100, 35, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0xxx"); //it.printf(130, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s °C", id(xxx).state.c_str()); // Tankstelle 1
it.printf(100, 65, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0xxx"); //it.printf(130, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s °C", id(xxx).state.c_str()); // Tankstelle 2
//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 <std::string, std::string> 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 = 5; 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 PA", value); } else if (i == 4) { // windpeed it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s m/s", value); } y += 25; previous = current + 1; current = actualWeatherCSV.find(delim, previous); } }
// Weather Forecast if(id(epaper_weather_forecast).has_state()) { std::string forecastWeatherCSV = id(epaper_weather_forecast).state; // Mon;sunny;16,5;5,1;Tue;sunny;17,2;6,8;Wed;sunny;15,4;2,7;Thu;sunny;15,3;4,6;Fri;partlycloudy;16,0;3,5 ESP_LOGI("Weather forecast", "%s", forecastWeatherCSV.c_str()); std::size_t current, previous = 0; char delim = ';'; current = forecastWeatherCSV.find(delim); x = 5; y = 270; int nextRow =0; for (int i=0; i<20; i++) { const char * value = forecastWeatherCSV.substr(previous, current - previous).c_str(); if(i == 0 || i == 4 || i == 8 || i == 12 || i == 16) { // Weekday it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s", value); } else if (i == 1 || i == 5 || i == 9 || i == 13 || i == 17) { // icon it.printf(x + 50 , y, id(materialdesign_icons_32), TextAlign::BASELINE_LEFT, weatherMap.at(value).c_str()); } else if (i == 2 || i == 6 || i == 10 || i == 14 || i == 18) { // Temp high it.printf(x + 100 , y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s°C", value); } else if (i == 3 || i == 7 || i == 11 || i == 15 || i == 19) { // Temp low it.printf(x + 170, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s °C", value); } nextRow = nextRow + 1; if (nextRow == 4) { y += 28; nextRow = 0; } previous = current + 1; current = forecastWeatherCSV.find(delim, previous); } }
// -- 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(); # Wifi Signal - platform: wifi_signal id: wifisignal update_interval: 60s 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_weather_forecast entity_id: sensor.epaper_weather_forecast 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

Ich bin mir nicht sicher, ob ich die Sensor-Bezeichnung erst noch in der configuration.yaml definieren muss, da sie in HA ja eigentlich schon auftauchen...

Benutzeravatar
Osorkon
Administrator
Beiträge: 1951
Registriert: Sa 17. Jul 2021, 16:53
2
Wohnort: Langenargen
Has thanked: 61 times
Been thanked: 530 times
Kontaktdaten:

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Osorkon »

Zuerst musst im ESPHome die Sensoren definieren, welche Du auf dem Display ausgeben willst.

BSP:

Code: Alles auswählen

sensor:
  - platform: homeassistant
    id: speedtestupload
    entity_id: sensor.speedtest_upload
    internal: true

Du kannst auch mehrere Sensoren anlegen.

Dann kannst Du diese im Bereich display: lambda angeben, in welcher Zeile die Sensor Werte ausgegeben werden sollen.

Code: Alles auswählen

    lambda: |-
      it.printf("U:%2.1f", id(speedtestupload).state);

Schaue Dir auch mal dieses Tutoriell an.

Edit: @SmarTiger ich habe mir erlaubt das Thema in das richtige Unterforum zu verschieben.

Gruß
Osorkon

Einer muss ja für Ordnung sorgen. :D
SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Herzlichen Dank für das schnelle Feedback - ich werde das umgehend ausprobieren :)
Als "Dummie" war mir auch nicht klar in welches Forum das gehört :oops:

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Erfolg!
nach folgendem Muster hat es funktioniert:

Code: Alles auswählen

#Anzeige
lambda: |-
      it.printf("%s € - Tankstelle XX", id(tankstelle_e10).state);

#Sensor
sensor:
  - platform: homeassistant
    id: tankstelle_e10
    entity_id: sensor.tankstelle_super_e10
    internal: true

Wenn die Tankstelle (z.B. nachts) geschlossen ist, wird als Preis "unknown" angezeigt - was aber nicht problematisch ist. Auf diese Weise habe ich jetzt mehrere Tankstellen der Umgebung auf meinem "Info-Board" :)

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Für die, die es interessiert, als Anhang, ein Bild von meinem "Info-Display".

Beispiel2.gif
Beispiel2.gif (264.28 KiB) 894 mal betrachtet

Baustellen sind für mich noch das Übersetzen der englischen Tages-/Monatsbezeichnungen in Deutsch (irgendwo muss ich da wohl ein "String-Übersetzungs-Skript" einfügen). Dann kommen auch noch Raumtemperarturanzeigen und Gasverbrauch hinzu - Platz ist da ja noch...

Andreas
Beiträge: 493
Registriert: Di 21. Dez 2021, 22:05
2
Wohnort: Geltow
Has thanked: 116 times
Been thanked: 22 times

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Andreas »

Die "Übersetzung" hier
https://smarthomeyourself.de/wiki/homea ... rmatieren/
kommt von Osorkon. Das hat mir echt geholfen.
Vielleicht hilft dir dieser Post auch ein wenig weiter.
viewtopic.php?t=85
Gruß, Andreas

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Vielen, lieben Dank für die Tipps! :D

Andreas
Beiträge: 493
Registriert: Di 21. Dez 2021, 22:05
2
Wohnort: Geltow
Has thanked: 116 times
Been thanked: 22 times

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Andreas »

Hallo SmarTiger,
hat denn was geholfen? Womit bist Du weiter gekommen?
Gruß, Andreas

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Nun, die "Übersetzungsproblematik" habe ich erstmal auf das nächste Jahr verschoben. Das Integrieren weiterer Sensoren schreitet aber voran:
Bild
Da werde ich evtl. noch etwas mit dem Zeichensatz herumexperimentieren und sicher gibt es noch andere Dinge, die sich lohnen, auf so einem "Info-Board" angezeigt zu werden :idea: ...
Das Script über WLAN neu einzulesen geht ja recht problemlos. 8-)

Guten Rutsch!

Dateianhänge
20231230_145234_1.jpg
20231230_145234_1.jpg (356.74 KiB) 768 mal betrachtet
Benutzeravatar
Osorkon
Administrator
Beiträge: 1951
Registriert: Sa 17. Jul 2021, 16:53
2
Wohnort: Langenargen
Has thanked: 61 times
Been thanked: 530 times
Kontaktdaten:

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Osorkon »

SmarTiger hat geschrieben: Sa 30. Dez 2023, 15:22

Nun, die "Übersetzungsproblematik" habe ich erstmal auf das nächste Jahr verschoben.

Geht es um die Übersetzung der Wochentage?
Dann kann vielleicht Dieser Beitrag hilfreich sein.

Gruß
Osorkon

Einer muss ja für Ordnung sorgen. :D
SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Danke @Osorkon :D
Das Beispiel sieht wirklich sehr verständlich aus und ich werde mich demnächst daran versuchen.

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Hallo @Osorkon ,
nun ist sie doch wieder da- die "Dummy-Denkblockade":
Für die Wetteranzeige habe ich dieses Script:

Code: Alles auswählen

// Wetter Vorhersage
     if(id(epaper_weather_forecast).has_state()) {
       std::string forecastWeatherCSV = id(epaper_weather_forecast).state; // Mon;sunny;16,5;5,1;Tue;sunny;17,2;6,8;Wed;sunny;15,4;2,7;Thu;sunny;15,3;4,6;Fri;partlycloudy;16,0;3,5
       ESP_LOGI("Weather forecast", "%s", forecastWeatherCSV.c_str());
       std::size_t current, previous = 0;
       char delim = ';';
       current = forecastWeatherCSV.find(delim);
       x = 5; y = 270;
       int nextRow =0;
       for (int i=0; i<20; i++) {
           const char * value = forecastWeatherCSV.substr(previous, current - previous).c_str();
           if(i == 0 || i == 4 || i == 8 || i == 12 || i == 16) { // Weekday
              it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s", value);
           } else if (i == 1 || i == 5 || i == 9 || i == 13 || i == 17) { // icon
             it.printf(x + 50  , y, id(materialdesign_icons_32), TextAlign::BASELINE_LEFT, weatherMap.at(value).c_str()); 
           } else if (i == 2 || i == 6 || i == 10 || i == 14 || i == 18) { // Temp high
              it.printf(x + 100 , y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s°C", value);
           } else if (i == 3 || i == 7 || i == 11 || i == 15 || i == 19) { // Temp low
              it.printf(x + 170, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s°C", value);
           }
           nextRow = nextRow + 1;
           if (nextRow == 4) {
             y += 28;
             nextRow = 0;
           }
           previous = current + 1;
           current = forecastWeatherCSV.find(delim, previous);
       }
     }

Für die Zeitdarstellung oben rechts folgendes:

Code: Alles auswählen

// Zeit
     it.strftime(540, 100, id(watch_font),TextAlign::BOTTOM_LEFT, "%H:%M", id(time_homeassistant).now());
     it.strftime(530, 110, id(openSansBold_font),TextAlign::BOTTOM_LEFT, "%a, %d.%m.%y, KW %W", id(time_homeassistant).now());

Wie muss ich es tatsächlich anstellen, um in dem "Wetterstring" den "Weekday" zu übersetzen (forecastweatherCSV?)- und muss ich da wieder anders vorgehen, um das englische "%d" in der "strftime-Zeile" zu ändern?
In dem "Müllkalender-Beispiel" ist das recht einfach nachzuvollziehen, für das, was ich da eingebaut habe, aber leider nicht ...

Auf der Übersichts-Seite von HA wird dieser Wetterbereich "Weather forecast from met.no" ja in deutsch angezeigt - gibt es da evtl. eine bessere Methode, genau diese Anzeige auch auf dem "epaper-Display" anzeigen zu lassen?

Benutzeravatar
Markus
Beiträge: 437
Registriert: Fr 23. Jul 2021, 09:03
2
Wohnort: Österreich
Has thanked: 21 times
Been thanked: 8 times

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von Markus »

Das Bild/Dashboard gefällt mir sehr gut, hast du auch ein Gesamtbild der fertigen Lösung? (Einbaurahmen, Montage)
Nutzt du eine permanente Stromversorgung?

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Das Dashboard ist bei mir eher in einem "experimentellem" Stadium. Es ist einfach Rahmenlos auf eine Sicherungskastentür im Flur geklebt - ein kleiner Durchbruch für die Anschlussfolie, die hinter der Tür an einem mit einem "Waveshare E-Paper ESP32 Driver Board" verbunden ist. Dieser ist über ein USB-Kabel an einem 5V Hutschienennetzteil angeschlossen. Ist also eine simple Konstruktion...
Wenn es um "schick" geht wäre das hier ein vielversprechendes Beispiel: "https://martinteske-blog.de/e-paper-hom ... ard-teil-1"

SmarTiger
Beiträge: 13
Registriert: Mi 6. Dez 2023, 11:28
Has thanked: 1 time

Re: Sensoren mit ESPhome auf epaper anzeigen

Beitrag von SmarTiger »

Die simple Konstruktion hier als etwas größerer Ausschnitt:

20240102_web.jpg
20240102_web.jpg (408.32 KiB) 697 mal betrachtet

Nun habe ich auch einen Müll-Kalender hinzugefügt...
Ohne jetzt auf die einzelnen "Sensoren" einzugehen, hier das gesamte Skript zur Anzeige der Daten auf dem Display:

Code: Alles auswählen

esphome:
  name: esphome-web-XXX
  friendly_name: epaper75

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXX"

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Optional manual IP
  manual_ip:
    static_ip: XXX.XXX.XXX.XXX
    gateway: !secret gateway_secret
    subnet: !secret subnet_secret

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-XXX"
    password: "XXX"
  
captive_portal:
# Example configuration entry spi: clk_pin: 13 mosi_pin: 14 # --- Fonts -------------------------------------------------------------------- font: - file: 'fonts/OpenSans-Medium.ttf' id: openSansBold_font size: 22 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/7.4.47/ 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 "\U000F0298", # mdi-gas-station "\U000F02CA", # mdi-harddisk "\U000F0A72", # mdi-solar-power "\U000F0D3E", # mdi-transmission-tower "\U000F0199", # mdi-counter "\U000F1A5A", # mdi-meter-gas "\U000F0238", # mdi-fire "\U000F12FE", # mdi-molecule-Co "\U000F044C", # mdi-recycle ]
- 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, 380); // Vertical first line it.line(532, 108, 532, 440); // Vertical second line
// Sonnenauf- / untergang it.printf(5, 35, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059C"); it.printf(35, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunrise).state.c_str());
it.printf(5, 65, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F059B"); it.printf(35, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(epaper_sunset).state.c_str()); // Festplattenrestspeicher it.printf(5, 95, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F02CA"); it.printf(35, 100, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s GB", id(disk_free).state.c_str());
// Tankstellenpreise it.printf(130, 35, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0298"); it.printf(160, 40, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s € - RAISA XXX", id(raisa_e10).state.c_str()); // Tankstelle XXX
it.printf(130, 65, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0298"); it.printf(160, 70, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s € - STAR XXX", id(star_e10).state.c_str()); // Tankstelle XXX
it.printf(130, 95, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0298"); it.printf(160, 100, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s € - HEM XXX", id(hem_e10).state.c_str()); // Tankstelle XXX // Energie it.printf(275, 140, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0A72"); it.printf(305, 145, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s W", id(solar_energy).state.c_str()); // Solar-Power
it.printf(275, 170, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0D3E"); it.printf(305, 175, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s W", id(strom_aktuell).state.c_str()); // Stromverbr_aktuell it.printf(275, 200, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F0199"); it.printf(305, 205, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s kWh", id(strom_zaehler).state.c_str()); // Stromzaehler_Stand
it.printf(275, 230, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F1A5A"); it.printf(305, 235, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s m³", id(gas_zaehler).state.c_str()); // Gaszaehler_Stand // Muell it.printf(5, 430, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F044C"); it.printf(35, 435, id(openSansBold_font), TextAlign::BOTTOM_LEFT, id(muell).state.c_str()); // Abholtermin_Muell // Gas-Sensoren it.printf(535, 140, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F050F"); it.printf(565, 145, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "Wohnzimmer: %s°C", id(temperatur_sensor_1).state.c_str()); // °C it.printf(535, 170, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F058E"); it.printf(565, 175, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s %%", id(feuchte_sensor_1).state.c_str()); // Feuchte it.printf(535, 200, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F12FE"); it.printf(565, 205, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s ppm", id(gas_sensor_1).state.c_str()); // CO it.printf(535, 240, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F050F"); it.printf(565, 245, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "Keller: %s°C", id(temperatur_sensor_2).state.c_str()); // °C it.printf(535, 270, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F058E"); it.printf(565, 275, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s %%", id(feuchte_sensor_2).state.c_str()); // Feuchte it.printf(535, 300, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F12FE"); it.printf(565, 305, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s ppm", id(gas_sensor_2).state.c_str()); // CO it.printf(535, 340, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F050F"); it.printf(565, 345, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "Heizung: %s°C", id(temperatur_sensor_3).state.c_str()); // °C it.printf(535, 370, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F058E"); it.printf(565, 375, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s %%", id(feuchte_sensor_3).state.c_str()); // Feuchte it.printf(535, 400, id(materialdesign_icons_25), TextAlign::BASELINE_LEFT, "\U000F12FE"); it.printf(565, 405, id(openSansBold_font), TextAlign::BOTTOM_LEFT, "%s ppm", id(gas_sensor_3).state.c_str()); // CO
// Zeit it.strftime(540, 100, id(watch_font),TextAlign::BOTTOM_LEFT, "%H:%M", id(time_homeassistant).now()); it.strftime(530, 110, id(openSansBold_font),TextAlign::BOTTOM_LEFT, "%a, %d.%m.%y, KW %W", id(time_homeassistant).now());
// Wetter aktuell
std::map <std::string, std::string> 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 = 5; 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 PA", value); } else if (i == 4) { // windpeed it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s m/s", value); } y += 25; previous = current + 1; current = actualWeatherCSV.find(delim, previous); } }
// Wetter Vorhersage if(id(epaper_weather_forecast).has_state()) { std::string forecastWeatherCSV = id(epaper_weather_forecast).state; // Mon;sunny;16,5;5,1;Tue;sunny;17,2;6,8;Wed;sunny;15,4;2,7;Thu;sunny;15,3;4,6;Fri;partlycloudy;16,0;3,5 ESP_LOGI("Weather forecast", "%s", forecastWeatherCSV.c_str()); std::size_t current, previous = 0; char delim = ';'; current = forecastWeatherCSV.find(delim); x = 5; y = 270; int nextRow =0; for (int i=0; i<20; i++) { const char * value = forecastWeatherCSV.substr(previous, current - previous).c_str(); if(i == 0 || i == 4 || i == 8 || i == 12 || i == 16) { // Weekday it.printf(x, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s", value); } else if (i == 1 || i == 5 || i == 9 || i == 13 || i == 17) { // icon it.printf(x + 50 , y, id(materialdesign_icons_32), TextAlign::BASELINE_LEFT, weatherMap.at(value).c_str()); } else if (i == 2 || i == 6 || i == 10 || i == 14 || i == 18) { // Temp high it.printf(x + 100 , y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s°C", value); } else if (i == 3 || i == 7 || i == 11 || i == 15 || i == 19) { // Temp low it.printf(x + 170, y, id(openSansBold_font), TextAlign::BASELINE_LEFT,"%s°C", value); } nextRow = nextRow + 1; if (nextRow == 4) { y += 28; nextRow = 0; } previous = current + 1; current = forecastWeatherCSV.find(delim, previous); } }
// -- Footer --- // IP Adresse 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 Signalstärke if(id(wifisignal).has_state()) { x = 245, 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(530, 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(); # Wifi Signal - platform: wifi_signal id: wifisignal update_interval: 60s text_sensor: # ESP WLAN IP Adresse - platform: wifi_info ip_address: name: "${name} IP Address" id: ip_address # ESP Home UpTime - platform: template id: uptime_human icon: mdi:clock-start # Wettervorhersage - platform: homeassistant id: epaper_weather_actual entity_id: sensor.epaper_weather_actual internal: true - platform: homeassistant id: epaper_weather_forecast entity_id: sensor.epaper_weather_forecast internal: true - platform: homeassistant # Sonnenauf- / untergang id: epaper_sunrise entity_id: sensor.epaper_sunrise internal: true - platform: homeassistant id: epaper_sunset entity_id: sensor.epaper_sunset internal: true # Benzinpreise - platform: homeassistant id: raisa_e10 entity_id: sensor.raiffeisen_XXX_super_e10 internal: true - platform: homeassistant id: star_e10 entity_id: sensor.star_XXX_super_e10 internal: true - platform: homeassistant id: hem_e10 entity_id: sensor.hem_XXX_super_e10 internal: true # Festplattenspeicher - platform: homeassistant id: disk_free entity_id: sensor.home_assistant_host_disk_free internal: true # W - F0A72 mdi-solar-power - platform: homeassistant id: solar_energy entity_id: sensor.wlan_solar_energy_power internal: true # W - F0D3E mdi-transmission-tower - platform: homeassistant id: strom_aktuell entity_id: sensor.tasmota_lk13be_power_curr internal: true # kWh - F0199 mdi-counter - platform: homeassistant id: strom_zaehler entity_id: sensor.tasmota_lk13be_power_total_in internal: true # m³ - F0238 mdi-fire - platform: homeassistant id: gas_zaehler entity_id: sensor.gaszaehler_gasverbrauch internal: true # ppm - F12FE mdi-CO - platform: homeassistant id: gas_sensor_1 entity_id: sensor.az_envy_1_gassensor internal: true # % - F058E mdi-water-percent - platform: homeassistant id: feuchte_sensor_1 entity_id: sensor.az_envy_1_luftfeuchtigkeit internal: true # °C - F050F mdi-thermometer - platform: homeassistant id: temperatur_sensor_1 entity_id: sensor.az_envy_1_temperatur internal: true # ppm - F12FE mdi-CO - platform: homeassistant id: gas_sensor_2 entity_id: sensor.az_envy_2_gassensor internal: true # % - F058E mdi-water-percent - platform: homeassistant id: feuchte_sensor_2 entity_id: sensor.az_envy_2_luftfeuchtigkeit internal: true # °C - F050F mdi-thermometer - platform: homeassistant id: temperatur_sensor_2 entity_id: sensor.az_envy_2_temperatur internal: true # ppm - F12FE mdi-CO - platform: homeassistant id: gas_sensor_3 entity_id: sensor.az_envy_3_gassensor internal: true # % - F058E mdi-water-percent - platform: homeassistant id: feuchte_sensor_3 entity_id: sensor.az_envy_3_luftfeuchtigkeit internal: true # °C - F050F mdi-thermometer - platform: homeassistant id: temperatur_sensor_3 entity_id: sensor.az_envy_3_temperatur internal: true # muell - F044C mdi-recycle - platform: homeassistant id: muell entity_id: sensor.muell internal: true time: - platform: homeassistant id: time_homeassistant

Was einen örtlichen - und damit individuellen- Bezug hat, habe ich durch XXX ersetzt ...
Ein "Nicht-Dummy" wird da sicher Verbesserungspotential erkennen :geek:
Den Ursprung hat dieses Skript hier: "https://www.it-adviser.net/home-assista ... erstation/"

Antworten