Reorganized Umwelt-Panel.

This commit is contained in:
Marcus Scholz 2021-10-08 18:14:51 +02:00
parent 0abbd5ccf6
commit 313037040e
1 changed files with 19 additions and 18 deletions

View File

@ -28,8 +28,8 @@ logger:
# Enable Home Assistant API
api:
password: !secret api
encryption:
key: !secret apikey
# encryption:
# key: !secret apikey
ota:
password: !secret ota
@ -274,7 +274,7 @@ display:
/* OUTSIDE */
it.print(10, 10, id(big_sensor_unit), "Umwelt");
// Draw the outline of a rectangle with the top left at [78,21], a width of 305 and a height of 3
it.filled_rectangle(78, 21, 305, 3);
it.filled_rectangle(86, 21, 297, 3);
if(id(sun_state).has_state()) {
ESP_LOGI("Sun", "State of the sun: %s", id(sun_state).state.c_str());
ESP_LOGD("Sun", "Sunset: %s", id(sun_set).state.c_str());
@ -284,9 +284,9 @@ display:
//if(id(sun_state).state == "above_horizon") {
it.print(10, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); //sun-up
it.printf(50, 75, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "%s", id(sun_rise).state.c_str());
it.printf(50, 75, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_rise).state.c_str());
it.print(135, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖛"); //sun-down
it.printf(175, 75, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "%s", id(sun_set).state.c_str());
it.printf(175, 75, id(big_sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_set).state.c_str());
//it.strftime(50, 75, id(footer_font), TextAlign::BASELINE_LEFT, "Nächster Sonnenuntergang %d.%m.%Y %H:%M", id(sun_set).state.c_str());
//}
//else {
@ -294,7 +294,7 @@ display:
//it.strftime(50, 75, id(footer_font), TextAlign::BASELINE_LEFT, "Nächster Sonnenaufgang %d.%m.%Y %H:%M", id(sun_rise));
//}
}
it.print(10, 115, id(mdi_small), TextAlign::BASELINE_LEFT, "󰊚"); //air-pressure
it.print(250, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰊚"); //air-pressure
it.print(375, 75, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); //thermometer
it.print(375, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); //water-percent
@ -313,50 +313,51 @@ display:
}
if(air_pressure < 1200 && air_pressure >=800) { //Has valid value
it.printf(50, 115, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "%4.1fhPa", air_pressure);
it.printf(228, 115, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%4.1fhPa", air_pressure);
}
else { //Invalid or error value
it.print(50, 115, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "- hPa");
it.print(228, 115, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "- hPa");
}
/* Moon phase display */
if(id(moonphase).has_state()) {
int x = 526;
int y = 276;
int x = 10;
int y = 116;
if (id(moonphase).state == "new_moon") {
// new moon
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽤");
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_CENTER, "󰽧");
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_CENTER, "󰽡");
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_CENTER, "󰽨");
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_CENTER, "󰽢");
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_CENTER, "󰽦");
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_CENTER, "󰽣");
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_CENTER, "󰽥");
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");
}
}