Add native cycle-and-soak with minimum soak time and interleaving - #236
Open
JB09 wants to merge 520 commits into
Open
Add native cycle-and-soak with minimum soak time and interleaving#236JB09 wants to merge 520 commits into
JB09 wants to merge 520 commits into
Conversation
Cycle-and-soak already interleaves zones on the scheduled, adjust_time and manual_run paths (all three share IUSequenceRun.build/_build_cycle). Add explicit regression coverage for the manual_run path, which drives the sequence through a manual run with no time override and asserts the interleaved cycle order with drop-out. Bump the version so HACS custom-repository installs pick up the build that contains the interleaving scheduler.
Enhance pause/resume functionality
Allow the cycle block to be set on an individual sequence zone, with each field falling back to the sequence-level cycle when not set on the zone. This enables a different max_duration (runoff threshold) per zone while inheriting min_duration and min_soak, and lets a sequence enable cycle-and-soak from zone-level blocks alone. Reuses the existing CYCLE_SCHEMA, IUSequenceCycle and calc_cycles. The resolver mirrors the existing zone_delay_config/zone_duration_config fall-through pattern. min_soak becomes per-zone via the resolved cycle. Fully backwards compatible: a config with only a sequence-level cycle resolves every zone to that cycle and behaves exactly as before. Bump version to 2026.6.2.
Sync the fork with 22 upstream commits (schema rename rgc99#237, reworked service handler/dispatcher rgc99#235, typing updates, DST fix for finish anchor, pause/resume enhancements, HA 2026.5.0 / test plugin bump). Merged cleanly with no conflicts; the native cycle-and-soak feature and per-zone overrides are preserved. Full test suite passes (123).
export_config did not serialise the sequence/zone cycle block, so a config using cycle-and-soak round-tripped without its max_duration, min_duration and min_soak (and per-zone overrides). Add a _cycle helper and emit it for both the sequence and each sequence zone when enabled. Adds a dedicated export test covering the sequence-level cycle and a per-zone max_duration override. Bump version to 2026.6.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #234.
Summary
Adds a native cycle-and-soak mode to sequences via a new
cycle:config block. Each zone’s total runtime is split into evenly distributed cycles capped at a configurable maximum, with a guaranteed minimum soak between a zone’s own cycles. During a zone’s soak, other pending zones in the same sequence run (interleaving), so the soak window is used productively instead of sitting idle — matching how commercial controllers (RainMachine, Rain Bird) handle slow-infiltrating soils like clay.Backwards compatible: sequences without a
cycle:block behave exactly as before.Config
Behavior
num_cycles = ceil(total / max_duration), thenper_cycle = total / num_cycles. Avoids a tiny trailing cycle (e.g. 45 min → 3 × 15, never 15 + 15 + 15 + remainder).num_cyclesis capped atfloor(total / min_duration)so no cycle runs shorter thanmin_duration. If a zone’s total is belowmin_duration, it runs once.min_soakis enforced.adjust_timeintegration — when a zone’s total is set viaadjust_time, the cycle logic re-derives the split from the new total, so integrations that push a daily total per zone (e.g. Smart Irrigation) work without the caller dividing by a cycle count. This also sidesteps therepeatmultiplication behavior reported in Smart Irrigation integration with Irrigation Unlimited not fully functional #203 / Despite different configuration the watering time is limited to one hour ("magically") #211.Testing
min_durationfloor,min_soakenforcement, interleaving order (most-time-remaining-first), drop-out, andadjust_timere-derivation.Front c1→ (soak) →Side Left c1— Side Left chosen over Side Right because it had more time remaining (2 min vs 1 min), confirming most-time-remaining-first rather than zone-label order.min_soakrespected between a given zone’s cycles.Other findings
cancelduring a cycled run — I noticedcanceldoes not always terminate all remaining cycles of an in-progress cycled run (areloadcleared it).