Fix: avoid unnecessary pump restart when switching between two active programs - #20
Open
julianhansen wants to merge 1 commit into
Open
Fix: avoid unnecessary pump restart when switching between two active programs#20julianhansen wants to merge 1 commit into
julianhansen wants to merge 1 commit into
Conversation
… programs start_program() unconditionally called stop_program() on the previously active program before enabling the new one, sending an explicit "disable" API PUT before the "enable" PUT. On an IntelliFlo/Pro3 VSF this causes the physical pump to fully stop for ~30s and ramp back up on every program switch via HA's switch.turn_on. The official Pentair Home app does not do this - switching between two already-running programs is a smooth in-place profile swap with no interruption to filtration, confirmed by direct physical observation (watched the pump switching via the app vs. via this integration - only this integration's stop-then-start sequence caused the hard restart). This skips the explicit stop_program() call when swapping between two programs on the same device. The old program's local running flag is still set to False so HA's switch entities report correct state, but no stop command is sent over the wire. Tested live on an IntelliFlo/Pro3 VSF with the Relay Control Board - switching between two 14-minute programs now keeps the pump running continuously, confirmed via HA logbook (no gap in speed/flow telemetry) and direct physical observation.
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.
PR title
Fix: avoid unnecessary pump restart when switching between two active programs
Description
start_program()currently always callsstop_program()on the previouslyactive program before enabling the new one:
This sends an explicit "disable" API PUT for the old program before the
"enable" PUT for the new one. In testing on an IntelliFlo/Pro3 VSF, this
causes the physical pump to fully stop for ~30 seconds and go through a
restart/ramp-up cycle every time you switch between two programs via a
switch.turn_oncall in Home Assistant.The official Pentair Home app does not do this - switching between two
already-running programs on the same device is a smooth, in-place profile
swap with no interruption to filtration. Confirmed by direct physical
observation (watched the pump while switching via the app vs. via this
integration - only this integration's stop-then-start sequence caused the
hard restart).
Fix
Skip the explicit
stop_program()API call when swapping between twoprograms on the same device. The old program's local
runningflag isstill set to
False(so HA's switch entities report correct state), butno "stop" command is sent over the wire -
start_program()'s own "enablenew program" PUT is sufficient, and the pump handles the transition itself.
Note:
stop_program()itself is untouched and still used correctly whenactually turning a program off with nothing replacing it (i.e. real
stop, not a swap) - this only changes the swap-between-two-programs path.
Testing
Applied and running live on an IntelliFlo/Pro3 VSF with the Relay Control
Board (5A/16A dual relay, one relay wired to an acid dosing pump gated by
"Speed/Flow Dependent"). Switching between two 14-minute programs (with a
different relay assignment on each) now keeps the pump running
continuously with no stop/restart - confirmed both via HA logbook (no gap
in speed/flow telemetry across the switch) and direct physical observation.
Possible follow-up (not in this PR, flagging for discussion)
The per-program
switchentities can be a little confusing since HA'sswitchdomain is strictly on/off -toggleandturn_onarefunctionally identical for these entities (both just call
start_program()), which isn't obvious from the entity type. Since theseprograms are really a single mutually-exclusive choice (only one can be
"active" at a time), a
selectentity (one dropdown listing allconfigured programs, "set to X" instead of N separate switches) might be
a more accurate fit for what's actually being modeled. Happy to take a
stab at that as a separate PR if there's interest - didn't want to bundle
an architecture change in with this bugfix.