20240410-21:12

This commit is contained in:
2024-04-10 21:12:15 +02:00
parent 523d1143f3
commit a863b212ed
10 changed files with 3222 additions and 2031 deletions

View File

@@ -124,15 +124,6 @@ font:
id: font_month
size: 40
# - file: fonts/materialdesignicons-webfont.ttf
# id: font_wifi
# size: 20
# glyphs:
# - "\U000F091F"
# - "\U000F0922"
# - "\U000F0925"
# - "\U000F0928"
# - "\U000F092B"
# Include Material Design Icons font
# Thanks to https://community.home-assistant.io/t/display-materialdesign-icons-on-esphome-attached-to-screen/199790/16
@@ -173,18 +164,6 @@ font:
- "\U000f010b" # mdi-car
- "\U000f0819" # trash
# - file: 'fonts/materialdesignicons-webfont.ttf'
# id: font_mdi_medlarge
# size: 60
# glyphs:
# - "\U000f0f64" # new moon
# - "\U000f0f67" # mdi-moon-waxing-crescent
# - "\U000F0F61" # mdi-moon-first-quarter
# - "\U000F0F68" # mdi-moon-waxing-gibbous
# - "\U000F0F62" # mdi-moon-full
# - "\U000F0F66" # mdi-moon-waning-gibbous
# - "\U000F0F63" # mdi-moon-last-quarter
# - "\U000F0F65" # mdi-moon-waning-crescent
- file: 'fonts/materialdesignicons-webfont.ttf'
id: font_mdi_medium
size: 36
@@ -203,7 +182,7 @@ sensor:
id: weather_temperature
on_value:
then:
- lambda: 'id(data_updated) = true;'
- lambda: 'id(data_updated) = true;'
- !include { file: sensors/homeassistant.yaml, vars: { id: weather_temperature_0, entity_id: sensor.e_ink_display_data }}
- !include { file: sensors/homeassistant.yaml, vars: { id: weather_temperature_1, entity_id: sensor.e_ink_display_data }}
@@ -246,9 +225,9 @@ sensor:
unit_of_measurement: "refreshes"
text_sensor:
- platform: homeassistant
entity_id: weather.forecast_home
id: weather_state
# - platform: homeassistant
# entity_id: weather.forecast_home
# id: weather_state
- !include { file: sensors/homeassistant.yaml, vars: { id: weather_condition_now, entity_id: sensor.e_ink_display_data }}
- !include { file: sensors/homeassistant.yaml, vars: { id: weather_condition_0, entity_id: sensor.e_ink_display_data}}
@@ -265,19 +244,6 @@ text_sensor:
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_ASML_name, entity_id: sensor.e_ink_display_data }}
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_euretco_name, entity_id: sensor.e_ink_display_data }}
- platform: homeassistant
entity_id: sensor.moon_phase
#attribute: icon
id: moon_phase
on_value:
then:
- lambda: 'id(data_updated) = true;'
- platform: homeassistant
entity_id: sensor.moon
id: moon
internal: true
# Sunrise
- platform: sun
type: sunrise
@@ -295,24 +261,6 @@ text_sensor:
then:
- lambda: 'id(data_updated) = true;'
- platform: wifi_info
ssid:
name: "${device_name} Connected SSID"
id: ssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
bssid:
name: "${device_name} Connected BSSID"
id: bssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
mac_address:
name: "${device_name} WiFi Mac Address"
id: macaddress
icon: mdi:wifi-strength-2
entity_category: diagnostic
- platform: sun
id: sunrise
@@ -361,12 +309,13 @@ display:
- platform: waveshare_epaper
cs_pin: GPIO27
dc_pin: GPIO16
busy_pin: GPIO25
busy_pin:
number: 25
inverted: True
reset_pin: GPIO26
model: 7.50in-bV2
#model: 7.50inv2b
#model: 7.50inv2
#model: 7.50inV2alt
reset_duration: 2ms
model: 7.50in-bv2-rb
#model: 7.50in-bV2
update_interval: 30min
id: eink_display
rotation: 90°
@@ -379,39 +328,9 @@ display:
int wifi_x_a = xres-x_pad;
int wifi_y_a = yres-y_pad+2;
// Fill background in black.
it.fill(COLOR_OFF);
// wifi strength
// if (id(sensor_wifi_signal).has_state())
// {
// if (id(sensor_wifi_signal).state >= -50) {
// //Excellent
// it.print(wifi_x_a, wifi_y_a, id(font_wifi), TextAlign::BASELINE_RIGHT, "󰤨");
// ESP_LOGI("WiFi", "Excellent");
// } else if (id(sensor_wifi_signal).state >= -60) {
// //Good
// it.print(wifi_x_a, wifi_y_a, id(font_wifi), TextAlign::BASELINE_RIGHT, "󰤥");
// ESP_LOGI("WiFi", "Good");
// } else if (id(sensor_wifi_signal).state >= -67) {
// //Fair
// it.print(wifi_x_a, wifi_y_a, id(font_wifi), TextAlign::BASELINE_RIGHT, "󰤢");
// ESP_LOGI("WiFi", "Fair");
// } else if (id(sensor_wifi_signal).state >= -70) {
// //Weak
// it.print(wifi_x_a, wifi_y_a, id(font_wifi), TextAlign::BASELINE_RIGHT, "󰤟");
// ESP_LOGI("WiFi", "Weak");
// } else {
// //Unlikely working signal
// it.print(wifi_x_a, wifi_y_a, id(font_wifi), TextAlign::BASELINE_RIGHT, "󰤫");
// ESP_LOGI("WiFi", "Unlikely");
// }
//}
// clock section
int clk_yoffset = 50;
int clk_xoffset = 310;
@@ -437,7 +356,7 @@ display:
if(id(sun_sunset).has_state ()) {
it.printf(385, sry_offset, id(font_small_bold), TextAlign::CENTER_RIGHT, "%s", id(sun_sunset).state.c_str());
}
// Moonphae
// Moonphase
//it.printf(265, sry_offset, id(font_mdi_medlarge), TextAlign::CENTER, "%s", moon_icon_map[id(moon_phase).state.c_str()].c_str());
it.line(30, sry_offset+30, 420, sry_offset+30);

View File

@@ -2,38 +2,6 @@
#include <iostream>
// #define ICON_stop "\U000F04DB"
// #define ICON_play "\U000F040A"
// #define ICON_pause "\U000F03E4"
// std::string playbackStatusToIcon(bool playing, bool paused) {
// if (playing) return ICON_play;
// else if (paused) return ICON_pause;
// else return ICON_stop;
// }
// #define ICON_moon_first_quarter "\U000F0F61"
// #define ICON_moon_full "\U000F0F62"
// #define ICON_moon_last_quarter "\U000F0F63"
// #define ICON_moon_new "\U000F0F64"
// #define ICON_moon_waning_crescent "\U000F0F65"
// #define ICON_moon_waning_gibbous "\U000F0F66"
// #define ICON_moon_waxing_crescent "\U000F0F67"
// #define ICON_moon_waxing_gibbous "\U000F0F68"
// std::string moonToIcon(std::string moonPhase)
// {
// if (moonPhase == "new_moon") return ICON_moon_new;
// if (moonPhase == "waxing_crescent") return ICON_moon_waxing_crescent;
// if (moonPhase == "first_quarter") return ICON_moon_first_quarter;
// if (moonPhase == "waxing_gibbous") return ICON_moon_waxing_gibbous;
// if (moonPhase == "full_moon") return ICON_moon_full;
// if (moonPhase == "waning_gibbous") return ICON_moon_waning_gibbous;
// if (moonPhase == "last_quarter") return ICON_moon_last_quarter;
// if (moonPhase == "waning_crescent") return ICON_moon_waning_crescent;
// return "";
// }
// Map weather states to MDI characters.
std::map<std::string, std::string> weather_icon_map
{
@@ -70,76 +38,67 @@ std::map<std::string, std::string> weather_icon_map
{"car", "\U000f010b"},
{"trash", "\U000F0819"},
};
// std::map<std::string, std::string> moon_icon_map
// #define ICON_w_clear_night "\U000F0594"
// #define ICON_w_cloudy "\U000F0590"
// #define ICON_w_fog "\U000F0591"
// #define ICON_w_hail "\U000F0592"
// #define ICON_w_lightning "\U000F0593"
// #define ICON_w_lightning_rainy "\U000F067E"
// #define ICON_w_night_partly_cloudy "\U000F0F31"
// #define ICON_w_partly_cloudy "\U000F0595"
// #define ICON_w_pouring "\U000F0596"
// #define ICON_w_rainy "\U000F0597"
// #define ICON_w_snowy "\U000F0F36"
// #define ICON_w_snowy_rainy "\U000F067F"
// #define ICON_w_sunny "\U000F0599"
// #define ICON_w_windy "\U000F059D"
// #define ICON_w_windy_variant "\U000F059E"
// #define ICON_w_exceptional "\U000F0F38"
// std::string conditionToIcon(std::string condition, bool daytime)
// {
// { "mdi:moon-waxing-crescent", "\U000f0f67" },
// { "mdi:moon-first-quarter", "\U000F0F61" },
// { "mdi:moon-waxing-gibbous", "\U000F0F68" },
// { "mdi:moon-full", "\U000F0F62" },
// { "mdi:moon-waning-gibbous", "\U000F0F66" },
// { "mdi:moon-last-quarter", "\U000F0F63" },
// { "mdi:moon-waning-crescent", "\U000F0F65" },
// };
#define ICON_w_clear_night "\U000F0594"
#define ICON_w_cloudy "\U000F0590"
#define ICON_w_fog "\U000F0591"
#define ICON_w_hail "\U000F0592"
#define ICON_w_lightning "\U000F0593"
#define ICON_w_lightning_rainy "\U000F067E"
#define ICON_w_night_partly_cloudy "\U000F0F31"
#define ICON_w_partly_cloudy "\U000F0595"
#define ICON_w_pouring "\U000F0596"
#define ICON_w_rainy "\U000F0597"
#define ICON_w_snowy "\U000F0F36"
#define ICON_w_snowy_rainy "\U000F067F"
#define ICON_w_sunny "\U000F0599"
#define ICON_w_windy "\U000F059D"
#define ICON_w_windy_variant "\U000F059E"
#define ICON_w_exceptional "\U000F0F38"
std::string conditionToIcon(std::string condition, bool daytime)
{
if (condition == "clear") return ICON_w_clear_night;
if (condition == "clear-night") return ICON_w_clear_night;
if (condition == "cloudy") return ICON_w_cloudy;
if (condition == "dust") return ICON_w_fog;
if (condition == "dusty") return ICON_w_fog;
if (condition == "fog") return ICON_w_fog;
if (condition == "frost") return ICON_w_snowy;
if (condition == "hail") return ICON_w_hail;
if (condition == "haze") return ICON_w_fog;
if (condition == "hazy") return ICON_w_fog;
if (condition == "heavy_shower") return ICON_w_rainy;
if (condition == "heavy_showers") return ICON_w_rainy;
if (condition == "light_rain") return ICON_w_rainy;
if (condition == "light_showers") return ICON_w_rainy;
if (condition == "light_shower") return ICON_w_rainy;
if (condition == "lightning") return ICON_w_lightning;
if (condition == "lightning-rainy") return ICON_w_lightning_rainy;
if (condition == "mostly_sunny") return ICON_w_sunny;
if (condition == "night") return ICON_w_clear_night;
if (condition == "partlycloudy" && !daytime) return ICON_w_night_partly_cloudy;
if (condition == "partlycloudy" && daytime) return ICON_w_partly_cloudy;
if (condition == "partly_cloudy" && !daytime) return ICON_w_night_partly_cloudy;
if (condition == "partly_cloudy" && daytime) return ICON_w_partly_cloudy;
if (condition == "pouring") return ICON_w_pouring;
if (condition == "rain") return ICON_w_rainy;
if (condition == "rainy") return ICON_w_rainy;
if (condition == "shower") return ICON_w_rainy;
if (condition == "showers") return ICON_w_rainy;
if (condition == "snow") return ICON_w_snowy;
if (condition == "snowy") return ICON_w_snowy;
if (condition == "snowy-rainy") return ICON_w_snowy_rainy;
if (condition == "storm") return ICON_w_lightning_rainy;
if (condition == "storms") return ICON_w_lightning_rainy;
if (condition == "sunny") return ICON_w_sunny;
if (condition == "wind") return ICON_w_windy;
if (condition == "windy") return ICON_w_windy;
if (condition == "windy-variant") return ICON_w_windy_variant;
if (condition == "exceptional") return ICON_w_exceptional;
return "";
}
// if (condition == "clear") return ICON_w_clear_night;
// if (condition == "clear-night") return ICON_w_clear_night;
// if (condition == "cloudy") return ICON_w_cloudy;
// if (condition == "dust") return ICON_w_fog;
// if (condition == "dusty") return ICON_w_fog;
// if (condition == "fog") return ICON_w_fog;
// if (condition == "frost") return ICON_w_snowy;
// if (condition == "hail") return ICON_w_hail;
// if (condition == "haze") return ICON_w_fog;
// if (condition == "hazy") return ICON_w_fog;
// if (condition == "heavy_shower") return ICON_w_rainy;
// if (condition == "heavy_showers") return ICON_w_rainy;
// if (condition == "light_rain") return ICON_w_rainy;
// if (condition == "light_showers") return ICON_w_rainy;
// if (condition == "light_shower") return ICON_w_rainy;
// if (condition == "lightning") return ICON_w_lightning;
// if (condition == "lightning-rainy") return ICON_w_lightning_rainy;
// if (condition == "mostly_sunny") return ICON_w_sunny;
// if (condition == "night") return ICON_w_clear_night;
// if (condition == "partlycloudy" && !daytime) return ICON_w_night_partly_cloudy;
// if (condition == "partlycloudy" && daytime) return ICON_w_partly_cloudy;
// if (condition == "partly_cloudy" && !daytime) return ICON_w_night_partly_cloudy;
// if (condition == "partly_cloudy" && daytime) return ICON_w_partly_cloudy;
// if (condition == "pouring") return ICON_w_pouring;
// if (condition == "rain") return ICON_w_rainy;
// if (condition == "rainy") return ICON_w_rainy;
// if (condition == "shower") return ICON_w_rainy;
// if (condition == "showers") return ICON_w_rainy;
// if (condition == "snow") return ICON_w_snowy;
// if (condition == "snowy") return ICON_w_snowy;
// if (condition == "snowy-rainy") return ICON_w_snowy_rainy;
// if (condition == "storm") return ICON_w_lightning_rainy;
// if (condition == "storms") return ICON_w_lightning_rainy;
// if (condition == "sunny") return ICON_w_sunny;
// if (condition == "wind") return ICON_w_windy;
// if (condition == "windy") return ICON_w_windy;
// if (condition == "windy-variant") return ICON_w_windy_variant;
// if (condition == "exceptional") return ICON_w_exceptional;
// return "";
// }