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 # Enable Home Assistant API
api: api:
password: !secret api password: !secret api
encryption: # encryption:
key: !secret apikey # key: !secret apikey
ota: ota:
password: !secret ota password: !secret ota
@ -274,7 +274,7 @@ display:
/* OUTSIDE */ /* OUTSIDE */
it.print(10, 10, id(big_sensor_unit), "Umwelt"); 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 // 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()) { if(id(sun_state).has_state()) {
ESP_LOGI("Sun", "State of the sun: %s", id(sun_state).state.c_str()); 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()); ESP_LOGD("Sun", "Sunset: %s", id(sun_set).state.c_str());
@ -284,9 +284,9 @@ display:
//if(id(sun_state).state == "above_horizon") { //if(id(sun_state).state == "above_horizon") {
it.print(10, 75, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); //sun-up 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.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()); //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 { //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.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, 75, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); //thermometer
it.print(375, 115, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); //water-percent 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 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 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 */ /* Moon phase display */
if(id(moonphase).has_state()) { if(id(moonphase).has_state()) {
int x = 526; int x = 10;
int y = 276; int y = 116;
if (id(moonphase).state == "new_moon") { if (id(moonphase).state == "new_moon") {
// 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"); ESP_LOGI("Moonphase", "new moon");
} else if (id(moonphase).state == "waxing_crescent") { } else if (id(moonphase).state == "waxing_crescent") {
// 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"); ESP_LOGI("Moonphase", "waxing crescent");
} else if (id(moonphase).state == "first_quarter") { } else if (id(moonphase).state == "first_quarter") {
// 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"); ESP_LOGI("Moonphase", "first quarter");
} else if (id(moonphase).state == "waxing_gibbous") { } else if (id(moonphase).state == "waxing_gibbous") {
// 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"); ESP_LOGI("Moonphase", "waxing gibbous");
} else if (id(moonphase).state == "full_moon") { } else if (id(moonphase).state == "full_moon") {
// 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"); ESP_LOGI("Moonphase", "full moon");
} else if (id(moonphase).state == "waning_gibbous") { } else if (id(moonphase).state == "waning_gibbous") {
// 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"); ESP_LOGI("Moonphase", "waning gibbous");
} else if (id(moonphase).state == "last_quarter") { } else if (id(moonphase).state == "last_quarter") {
// 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"); ESP_LOGI("Moonphase", "last quarter");
} else if (id(moonphase).state == "waning_crescent") { } else if (id(moonphase).state == "waning_crescent") {
// 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"); ESP_LOGI("Moonphase", "waning crescent");
} else { } else {
// N/A // N/A
it.print(x, y, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "-");
ESP_LOGE("Moonphase", "No data"); ESP_LOGE("Moonphase", "No data");
} }
} }