Public Access
Weather forecast page, 16 elements per page, attribute paths, examples from the display
- Home Assistant attributes can be paths into lists (forecast.1.condition). - Date elements can show a day ahead (day offset 0-7). - Pages hold 16 elements (page format 6; the old formats are frozen at 8). Pages are reset in place (clearPage), not through a 4 KB temporary. - Verwachting page: today (icon, temperature, max/min) and the next 2 days with 7 x 7 icons (weer7 <condition>), from a template sensor (docs/home-assistant.md). - examples/home-pages.json is exported from the display with all pages and their icons, private entity id parts replaced by placeholders (tools/export_examples.py replaces tools/make_example_pages.py). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
839e86e8f1
commit
a6b946e17c
33 files changed
+1918
-1050
No files matched your search
@@ -2273,6 +2273,68 @@ void test_bar_render()
|
||||
TEST_ASSERT_TRUE(bitmapPixel(b, 61, 17));
|
||||
}
|
||||
|
||||
void test_date_days_ahead()
|
||||
{
|
||||
LocalTime t; // Thursday 31 December 2026
|
||||
t.year = 2026;
|
||||
t.month = 12;
|
||||
t.day = 31;
|
||||
t.weekday = 4;
|
||||
LocalTime n = addDays(t, 1);
|
||||
TEST_ASSERT_EQUAL(2027, n.year);
|
||||
TEST_ASSERT_EQUAL(1, n.month);
|
||||
TEST_ASSERT_EQUAL(1, n.day);
|
||||
TEST_ASSERT_EQUAL(5, n.weekday);
|
||||
t.year = 2028; // leap year: 28 February + 1 = 29 February
|
||||
t.month = 2;
|
||||
t.day = 28;
|
||||
TEST_ASSERT_EQUAL(29, addDays(t, 1).day);
|
||||
TEST_ASSERT_EQUAL(3, addDays(t, 2).month);
|
||||
t.year = 2027;
|
||||
TEST_ASSERT_EQUAL(1, addDays(t, 1).day);
|
||||
|
||||
DynamicPage page;
|
||||
page.element_count = 1;
|
||||
PageElement &e = page.elements[0];
|
||||
e.type = ElementType::Date;
|
||||
e.format = DATE_WEEKDAY_SHORT;
|
||||
LocalTime thu;
|
||||
thu.year = 2026;
|
||||
thu.month = 10;
|
||||
thu.day = 15;
|
||||
thu.weekday = 4;
|
||||
char text[32];
|
||||
elementText(e, thu, ElementValues(), text, sizeof(text));
|
||||
TEST_ASSERT_EQUAL_STRING("do", text);
|
||||
e.day_offset = 3;
|
||||
elementText(e, thu, ElementValues(), text, sizeof(text));
|
||||
TEST_ASSERT_EQUAL_STRING("zo", text);
|
||||
TEST_ASSERT_NULL(validatePage(page));
|
||||
e.day_offset = 8;
|
||||
TEST_ASSERT_NOT_NULL(validatePage(page));
|
||||
e.day_offset = -1;
|
||||
TEST_ASSERT_NOT_NULL(validatePage(page));
|
||||
}
|
||||
|
||||
void test_attribute_paths_and_16_elements()
|
||||
{
|
||||
DynamicPage page;
|
||||
page.element_count = PAGE_ELEMENTS;
|
||||
TEST_ASSERT_EQUAL(16, PAGE_ELEMENTS);
|
||||
for (int i = 0; i < PAGE_ELEMENTS; i++)
|
||||
{
|
||||
page.elements[i].type = ElementType::HaValue;
|
||||
strcpy(page.elements[i].entity, "sensor.weer_verwachting");
|
||||
strcpy(page.elements[i].attribute, "forecast.1.templow");
|
||||
}
|
||||
TEST_ASSERT_NULL(validatePage(page));
|
||||
strcpy(page.elements[3].attribute, "forecast/1");
|
||||
TEST_ASSERT_NOT_NULL(validatePage(page));
|
||||
page.elements[3].attribute[0] = '\0';
|
||||
page.element_count = PAGE_ELEMENTS + 1;
|
||||
TEST_ASSERT_NOT_NULL(validatePage(page));
|
||||
}
|
||||
|
||||
void test_bar_validation()
|
||||
{
|
||||
DynamicPage page = barPage();
|
||||
@@ -2462,6 +2524,8 @@ int main()
|
||||
RUN_TEST(test_bar_fill);
|
||||
RUN_TEST(test_bar_render);
|
||||
RUN_TEST(test_bar_validation);
|
||||
RUN_TEST(test_date_days_ahead);
|
||||
RUN_TEST(test_attribute_paths_and_16_elements);
|
||||
RUN_TEST(test_plex_user_placeholder);
|
||||
RUN_TEST(test_slow_scrolling_below_one_dot_per_second);
|
||||
|
||||
|
||||
Reference in new issue
Block a user