From 7553508240dbc50c629598bcd102cdf42044e024 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 27 Oct 2021 14:10:16 +0200 Subject: [PATCH] v0.1.0 --- common/base.yaml | 2 +- common/display-hendrik.yaml | 239 ++++++++++++++++++++++++++++++++++++ common/display.yaml | 4 +- hendrik-test.yaml | 2 +- 4 files changed, 243 insertions(+), 4 deletions(-) create mode 100644 common/display-hendrik.yaml diff --git a/common/base.yaml b/common/base.yaml index c0ca127..81d84ff 100644 --- a/common/base.yaml +++ b/common/base.yaml @@ -4,7 +4,7 @@ esphome: board: lolin_d32_pro project: name: "xd0.esp32weatherstation2" - version: "0.0.9" + version: "0.1.0" includes: - fonts/weather_icon_map.h - custom/veml6075_custom_sensor.h diff --git a/common/display-hendrik.yaml b/common/display-hendrik.yaml new file mode 100644 index 0000000..fd9bfa1 --- /dev/null +++ b/common/display-hendrik.yaml @@ -0,0 +1,239 @@ +# display #250x122 pixels (250x128) +font: + - file: 'fonts/Vera.ttf' + id: font1 + size: 10 + glyphs: '!"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/²³µΩ€[]' + - file: 'fonts/Vera.ttf' + id: font2 + size: 20 +# - file: 'fonts/VeraMono.ttf' +# id: font3 +# size: 10 + - file: 'fonts/materialdesignicons-webfont.ttf' + id: icon_font + size: 48 + 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: + - platform: waveshare_epaper + cs_pin: 14 + dc_pin: 27 + reset_pin: 33 + model: 2.13in-ttgo + rotation: 90 + update_interval: 60s + full_update_every: 1 + id: my_display + pages: + - id: page1 + lambda: |- + it.print(10, 50, id(font2), "esp32weatherstation2"); + - id: page2 + lambda: |- + // Title + it.filled_rectangle(0,0,250,20, COLOR_ON); + it.print(5, 6, id(font1), COLOR_OFF, "${node_name}"); + it.strftime(150, 6, id(font1), COLOR_OFF, "%Y-%m-%d %H:%M", id(sntp_time).now()); + // Weather icon + if (id(weather_icon).has_state()) { + it.printf(0, 18, id(icon_font), weather_icon_map[id(weather_icon).state.c_str()].c_str()); + } + it.printf(55, 25, id(font1), "T: %.1f°C", id(temperature_outside).state); + it.printf(55, 35, id(font1), "H: %.1f%%", id(humidity_outside).state); + it.printf(55, 45, id(font1), "%.0fmm / %.0f%%", id(precipitation).state, id(precipitation_probability).state); + // own measurements + it.filled_rectangle(0, 65, 59, 33, COLOR_ON); + it.printf(2, 65+4, id(font2), COLOR_OFF, "%.1f", id(temperature).state); it.printf(45, 65+4, id(font1), COLOR_OFF, "°C"); + it.filled_rectangle(60, 65, 59, 33, COLOR_ON); + it.printf(62, 65+4, id(font2), COLOR_OFF, "%.1f", id(humidity).state); it.printf(105, 65+4, id(font1), COLOR_OFF, "%%"); + it.filled_rectangle(120, 65, 59, 33, COLOR_ON); + it.printf(122, 65+4, id(font2), COLOR_OFF, "%.0f", id(pressure_sealevel).state); it.printf(178, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "hPa"); + // humidity human readable + if (id(humidity).state < 30) { + it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "low"); + } else if (id(humidity).state < 60) { + it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "comfort"); + } else { + it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "high"); + } + // graphs + it.graph(0, 98, id(temperature_graph)); + it.graph(60, 98, id(humidity_graph)); + it.graph(120, 98, id(pressure_graph)); + // voc + it.circle(130, 42, 20); + it.line(115, 42, 145, 42); + it.filled_rectangle(130-10, 21, 20, 10, COLOR_OFF); + it.print(130, 26, id(font1), TextAlign::CENTER, "VOC"); + if (id(iaq_accuracy).state >= 2) { + it.printf(130, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f", id(iaq).state); + if (id(iaq).state < 50) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "excellent"); + } else if (id(iaq).state < 100) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "fine"); + } else if (id(iaq).state < 150) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "moderate"); + } else if (id(iaq).state < 200) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "poor"); + } else if (id(iaq).state < 300) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "very poor"); + } else if (id(iaq).state < 500) { + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "severe"); + } + } else { + it.printf(130, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f \u03A9", id(voc).state); + it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "VOC"); + } + // climate.wz + it.circle(175, 42, 20); + it.line(160, 42, 190, 42); + it.filled_rectangle(175-10, 21, 20, 10, COLOR_OFF); + it.print(175, 26, id(font1), TextAlign::CENTER, "WZ"); + it.printf(175, 41, id(font1), TextAlign::BASELINE_CENTER, "%.1f°C", id(temp_set_wz).state); + it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "%.1f°C", id(temp_wz).state); + // Benzinpreis + it.rectangle(200, 22, 40, 40); + it.line(205, 42, 235, 42); + it.filled_rectangle(220-10, 21, 20, 10, COLOR_OFF); + it.print(220, 26, id(font1), TextAlign::CENTER, "E5"); + it.printf(220, 41, id(font1), TextAlign::BASELINE_CENTER, "%.3f€", id(benzinpreis).state); + it.printf(220, 43, id(font1), TextAlign::TOP_CENTER, "%.3f€", id(benzinpreis2).state); + // other values + it.print(184, 75, id(font1), "UVI:"); it.printf(248, 75, id(font1), TextAlign::TOP_RIGHT, "%.2f", id(uvi_outdoor).state); + it.print(184, 85, id(font1), "YNH:"); it.printf(248, 85, id(font1), TextAlign::TOP_RIGHT, "%.2f", id(yunohost_load).state); + // Springer + it.print(184, 105, id(font1), "Bat:"); + if (id(battery_level).state >=0 && id(battery_level).state <= 100) { + it.printf(248, 105, id(font1), TextAlign::TOP_RIGHT, "%.0f%%", id(battery_level).state); + } else { + it.printf(248, 105, id(font1), TextAlign::TOP_RIGHT, "nc"); + } + + +interval: + - interval: 30s + then: + - if: + condition: + - display.is_displaying_page: page1 + then: + - display.page.show: page2 + - component.update: my_display + +graph: + # Show bare-minimum auto-ranged graph + - id: temperature_graph + duration: 1h + width: 59 + height: 31 + traces: + - sensor: temperature + line_type: SOLID + line_thickness: 2 +# - sensor: temperature_outside +# line_type: DASHED +# line_thickness: 1 + - id: humidity_graph + sensor: humidity + duration: 1h + width: 59 + height: 31 + - id: pressure_graph + sensor: pressure + duration: 1h + width: 59 + height: 31 + +# Example configuration entry +sensor: + - platform: homeassistant + name: "Temperature Outdoor" + internal: true + entity_id: weather.openweathermap + attribute: temperature + id: temperature_outside + - platform: homeassistant + name: "Humidity Outdoor" + internal: true + entity_id: weather.openweathermap + attribute: humidity + id: humidity_outside + - platform: homeassistant + name: "Precipitation Propability Forecast" + internal: true + entity_id: sensor.openweathermap_forecast_precipitation + id: precipitation + - platform: homeassistant + name: "Precipitation Probability Forecast" + internal: true + entity_id: sensor.openweathermap_forecast_precipitation_probability + id: precipitation_probability + - platform: homeassistant + name: "UVI Outdoor" + internal: true + entity_id: sensor.openweathermap_uv_index + id: uvi_outdoor + - platform: homeassistant + name: "WZ Temp" + internal: true + entity_id: climate.leq1333417 + attribute: current_temperature + id: temp_wz + - platform: homeassistant + name: "WZ Temp Set" + internal: true + entity_id: climate.leq1333417 + attribute: temperature + id: temp_set_wz + - platform: homeassistant + name: "Benzinpreis" + internal: true + entity_id: sensor.tankerkoenig_sb_essen_frankenstrasse_74_e5 + id: benzinpreis + - platform: homeassistant + name: "Benzinpreis2" + internal: true + entity_id: sensor.tankerkoenig_total_essen_e5 + id: benzinpreis2 + - platform: homeassistant + name: "Yunohost Load" + internal: true + entity_id: sensor.yunohost_load + id: yunohost_load + +text_sensor: + - platform: homeassistant + id: weather_icon + internal: true + entity_id: weather.openweathermap diff --git a/common/display.yaml b/common/display.yaml index 1951460..4741cec 100644 --- a/common/display.yaml +++ b/common/display.yaml @@ -64,7 +64,7 @@ display: // Title it.filled_rectangle(0,0,250,20, COLOR_ON); it.print(5, 6, id(font1), COLOR_OFF, "${node_name}"); - it.strftime(150, 6, id(font1), COLOR_OFF, "%Y-%m-%d %H:%M", id(sntp_time).now()); + it.strftime(150, 6, id(font1), COLOR_OFF, "%Y-%m-%d %H:%M", id(sntp_time).now()); // Weather icon if (id(weather_icon).has_state()) { it.printf(0, 18, id(icon_font), weather_icon_map[id(weather_icon).state.c_str()].c_str()); @@ -140,7 +140,7 @@ display: it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "VOC"); } // Particulate Matter Sensor - it.circle(220, 42, 20); + it.rectangle(200, 22, 40, 40); // it.circle(220, 42, 20); it.line(205, 42, 235, 42); it.filled_rectangle(220-10, 21, 20, 10, COLOR_OFF); it.print(220, 26, id(font1), TextAlign::CENTER, "PM"); diff --git a/hendrik-test.yaml b/hendrik-test.yaml index 9a1356d..ed0e429 100644 --- a/hendrik-test.yaml +++ b/hendrik-test.yaml @@ -5,7 +5,7 @@ substitutions: packages: base: !include common/base.yaml battery: !include common/battery.yaml - display: !include common/display.yaml + display: !include common/display-hendrik.yaml webserver: !include common/experimental/webserver.yaml env_sensor: !include common/bme680.yaml # remote_package: