Public Access
Schedule pages and rotation rules can be skipped in slow mode
Each page in a schedule block, and each rule that adds its page to the rotation, has a "skip in slow mode" checkbox. While slow mode is on those pages are left out of the rotation; when none of the block's pages are left, the chosen page is shown. The rotation keeps its own timers. Schedule format version 5; version 4 is converted when read and stored again in version 5 on the next save. Version 2.18.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a91d2550d7
commit
e9f3c16c78
13 files changed
+177
-13
No files matched your search
@@ -2122,6 +2122,41 @@ void test_selector_add_to_rotation()
|
||||
TEST_ASSERT_EQUAL_STRING("3D printer", sel2.update(600, CHOSEN_PAGE_SECONDS * 1000).page);
|
||||
}
|
||||
|
||||
void test_selector_skips_pages_in_slow_mode()
|
||||
{
|
||||
PageSchedule s = twoBlocks();
|
||||
s.blocks[0].items[1].skip_slow_mode = true; // Datum
|
||||
s.rule_count = 2;
|
||||
s.rules[0] = rule("3D printer", TriggerMode::AddToRotation, 15);
|
||||
s.rules[0].skip_slow_mode = true;
|
||||
s.rules[1] = rule("Afval", TriggerMode::AddToRotation, 15);
|
||||
PageSelector sel;
|
||||
sel.setSchedule(&s);
|
||||
sel.setChosen("Clock");
|
||||
sel.setRuleState(0, true, 0);
|
||||
sel.setRuleState(1, true, 0);
|
||||
sel.setSlowMode(true);
|
||||
TEST_ASSERT_EQUAL_STRING("Weer", sel.update(8 * 60, 0).page);
|
||||
TEST_ASSERT_EQUAL_STRING("Afval", sel.update(8 * 60, 20000).page); // no Datum, no printer
|
||||
TEST_ASSERT_EQUAL_STRING("Weer", sel.update(8 * 60, 35000).page);
|
||||
|
||||
// Off again: all of them
|
||||
sel.setSlowMode(false);
|
||||
TEST_ASSERT_EQUAL_STRING("Datum", sel.update(8 * 60, 55000).page);
|
||||
TEST_ASSERT_EQUAL_STRING("3D printer", sel.update(8 * 60, 65000).page);
|
||||
|
||||
// All of the block's pages skipped: the chosen page, plus the rules that stay
|
||||
s.blocks[0].items[0].skip_slow_mode = true;
|
||||
sel.setRuleState(1, false, 70000);
|
||||
sel.setSlowMode(true);
|
||||
PageChoice c = sel.update(8 * 60, 80000);
|
||||
TEST_ASSERT_EQUAL_STRING("Clock", c.page);
|
||||
TEST_ASSERT_TRUE(c.reason == ShowReason::Chosen);
|
||||
TEST_ASSERT_EQUAL_STRING("Clock", sel.update(8 * 60, 200000).page);
|
||||
TEST_ASSERT_FALSE(ScheduleItem().skip_slow_mode);
|
||||
TEST_ASSERT_FALSE(TriggerRule().skip_slow_mode);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Home Assistant value conversions
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -3271,6 +3306,7 @@ int main()
|
||||
RUN_TEST(test_selector_rule_over_slow_mode);
|
||||
RUN_TEST(test_selector_rule_can_leave_a_manual_pick_alone);
|
||||
RUN_TEST(test_selector_add_to_rotation);
|
||||
RUN_TEST(test_selector_skips_pages_in_slow_mode);
|
||||
RUN_TEST(test_ha_auto_unit_and_absolute);
|
||||
RUN_TEST(test_ha_duration);
|
||||
RUN_TEST(test_ha_timestamps);
|
||||
|
||||
Reference in new issue
Block a user