Untested, bare, dummy calendar page
This commit is contained in:
@@ -1110,6 +1110,88 @@ display:
|
|||||||
ESP_LOGI("WiFi", "Unlikely");
|
ESP_LOGI("WiFi", "Unlikely");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
- id: calendar
|
||||||
|
lambda: |-
|
||||||
|
/* Fetch today and tomorrow dates */
|
||||||
|
auto now = id(homeassistant_time).now();
|
||||||
|
int today_day = now.day_of_month;
|
||||||
|
int today_month = now.month;
|
||||||
|
int today_wday = now.day_of_week; // 0=Sunday .. 6=Saturday
|
||||||
|
const char* weekdays[] = {"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"};
|
||||||
|
const char* today_weekday_str = weekdays[today_wday];
|
||||||
|
int today_year = now.year;
|
||||||
|
|
||||||
|
/* Tomorrow's date */
|
||||||
|
int tomorrow_day = today_day + 1;
|
||||||
|
int tomorrow_month = today_month;
|
||||||
|
int tomorrow_wday = (today_wday + 1) % 7;
|
||||||
|
const char* tomorrow_weekday_str = weekdays[tomorrow_wday];
|
||||||
|
int tomorrow_year = today_year;
|
||||||
|
|
||||||
|
/* C1024 logo */
|
||||||
|
it.image(10, 37, id(c1024_logo));
|
||||||
|
|
||||||
|
/* ── LEFT PANE: Today ── */
|
||||||
|
int leftX = 0;
|
||||||
|
int leftY = 85; // start below header row
|
||||||
|
|
||||||
|
it.print(10 + leftX, 10 + leftY, id(sensor_unit), "Heute");
|
||||||
|
it.filled_rectangle(64 + leftX, 21 + leftY, 370, 3);
|
||||||
|
|
||||||
|
/* Today's date strip */
|
||||||
|
it.printf(50 + leftX, 50 + leftY, id(big_sensor_font), "%d", today_day);
|
||||||
|
it.printf(130 + leftX, 45 + leftY, id(sub_sensor_font), "%s.", today_weekday_str);
|
||||||
|
it.printf(160 + leftX, 45 + leftY, id(sensor_unit), "%02d.%04d.", today_month, today_year);
|
||||||
|
|
||||||
|
/* Event placeholder row (top) */
|
||||||
|
int eventOffsetY = 90;
|
||||||
|
it.print(10 + leftX, 50 + leftY + eventOffsetY, id(mdi_med), TextAlign::BASELINE_LEFT, "");
|
||||||
|
it.print(40 + leftX, 50 + leftY + eventOffsetY, id(sub_sensor_font), "Eintrag 1");
|
||||||
|
|
||||||
|
/* Event placeholder row (bottom) */
|
||||||
|
it.print(10 + leftX, 85 + leftY + eventOffsetY, id(mdi_med), TextAlign::BASELINE_LEFT, "");
|
||||||
|
it.print(40 + leftX, 85 + leftY + eventOffsetY, id(sub_sensor_font), "Eintrag 2");
|
||||||
|
|
||||||
|
/* ── RIGHT PANE: Tomorrow ── */
|
||||||
|
int rightX = 390;
|
||||||
|
int rightY = 85;
|
||||||
|
|
||||||
|
it.print(10 + rightX, 10 + rightY, id(sensor_unit), "Morgen");
|
||||||
|
it.filled_rectangle(64 + rightX, 21 + rightY, 370, 3);
|
||||||
|
|
||||||
|
/* Date strip */
|
||||||
|
it.printf(50 + rightX, 50 + rightY, id(big_sensor_font), "%d", tomorrow_day);
|
||||||
|
it.printf(130 + rightX, 45 + rightY, id(sub_sensor_font), "%s.", tomorrow_weekday_str);
|
||||||
|
it.printf(160 + rightX, 45 + rightY, id(sensor_unit), "%02d.%04d.", tomorrow_month, tomorrow_year);
|
||||||
|
|
||||||
|
/* Event placeholder row (top) */
|
||||||
|
it.print(10 + rightX, 50 + rightY + eventOffsetY, id(mdi_med), TextAlign::BASELINE_LEFT, "");
|
||||||
|
it.print(40 + rightX, 50 + rightY + eventOffsetY, id(sub_sensor_font), "Eintrag 1");
|
||||||
|
|
||||||
|
/* Event placeholder row (bottom) */
|
||||||
|
it.print(10 + rightX, 85 + rightY + eventOffsetY, id(mdi_med), TextAlign::BASELINE_LEFT, "");
|
||||||
|
it.print(40 + rightX, 85 + rightY + eventOffsetY, id(sub_sensor_font), "Eintrag 2");
|
||||||
|
|
||||||
|
/* FOOTER */
|
||||||
|
it.strftime(614, 380, id(footer_font), TextAlign::BASELINE_RIGHT, "Aktualisiert um %d.%m.%Y %H:%M", id(homeassistant_time).now());
|
||||||
|
|
||||||
|
/* WiFi Signal strength */
|
||||||
|
if(id(wifisignal).has_state()) {
|
||||||
|
int x = 630;
|
||||||
|
int y = 384;
|
||||||
|
if (id(wifisignal).state >= -50) {
|
||||||
|
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||||
|
} else if (id(wifisignal).state >= -60) {
|
||||||
|
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||||
|
} else if (id(wifisignal).state >= -75) {
|
||||||
|
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||||
|
} else if (id(wifisignal).state >= -100) {
|
||||||
|
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||||
|
} else {
|
||||||
|
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- id: power
|
- id: power
|
||||||
lambda: |-
|
lambda: |-
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user