Public Access
Rules can leave a manual pick alone, Clock is an editable page, fix HA attributes
- Rules: "also over a page chosen by hand" (on by default); off, a rule waits until the manual pick ends. Schedule store version 3, version 2 records are read with the option on. - The Clock page is stored at boot from the built-in one and can be edited; Reset (deleting it) brings back the original. - Home Assistant attributes were never found: ArduinoJson 7.4 takes a char array key as a literal of its full array length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab001e5d18
commit
51b8d87e86
37 files changed
+134
-42
No files matched your search
@@ -1841,6 +1841,37 @@ void test_selector_take_over_rules()
|
||||
TEST_ASSERT_TRUE(c.instant); // a rule's page leaves at once
|
||||
}
|
||||
|
||||
void test_selector_rule_can_leave_a_manual_pick_alone()
|
||||
{
|
||||
PageSchedule s = twoBlocks(); // 07:00 Weer + Datum, 17:00 Energie
|
||||
s.rule_count = 2;
|
||||
s.rules[0] = rule("3D printer", TriggerMode::WhileTrue);
|
||||
s.rules[0].over_manual = false;
|
||||
s.rules[1] = rule("Deurbel", TriggerMode::AddToRotation, 10);
|
||||
s.rules[1].over_manual = false;
|
||||
PageSelector sel;
|
||||
sel.setSchedule(&s);
|
||||
sel.update(8 * 60, 0);
|
||||
sel.setRuleState(0, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING("3D printer", sel.update(8 * 60, 0).page); // no pick: it takes over
|
||||
|
||||
sel.pick("Clock");
|
||||
PageChoice c = sel.update(8 * 60, 1000);
|
||||
TEST_ASSERT_EQUAL_STRING("Clock", c.page); // waits while the pick lasts
|
||||
TEST_ASSERT_TRUE(c.reason == ShowReason::Chosen);
|
||||
sel.setRuleState(1, true, 1000);
|
||||
for (uint32_t t = 1000; t < 120000; t += 5000)
|
||||
TEST_ASSERT_EQUAL_STRING("Clock", sel.update(8 * 60, t).page); // not in the rotation either
|
||||
|
||||
sel.backToSchedule();
|
||||
TEST_ASSERT_EQUAL_STRING("3D printer", sel.update(8 * 60, 121000).page);
|
||||
|
||||
// The next block ends a pick too
|
||||
sel.pick("Clock");
|
||||
TEST_ASSERT_EQUAL_STRING("Clock", sel.update(16 * 60, 122000).page);
|
||||
TEST_ASSERT_EQUAL_STRING("3D printer", sel.update(17 * 60, 123000).page);
|
||||
}
|
||||
|
||||
void test_selector_rules_only_in_their_blocks()
|
||||
{
|
||||
PageSchedule s = twoBlocks(); // 07:00 Weer + Datum, 17:00 Energie
|
||||
@@ -2415,6 +2446,7 @@ int main()
|
||||
RUN_TEST(test_selector_one_block_starts_again_each_day);
|
||||
RUN_TEST(test_selector_take_over_rules);
|
||||
RUN_TEST(test_selector_rules_only_in_their_blocks);
|
||||
RUN_TEST(test_selector_rule_can_leave_a_manual_pick_alone);
|
||||
RUN_TEST(test_selector_add_to_rotation);
|
||||
RUN_TEST(test_ha_auto_unit_and_absolute);
|
||||
RUN_TEST(test_ha_duration);
|
||||
|
||||
Reference in new issue
Block a user