From 142a46be75807d5c83c0ee9de65a05757b22cc11 Mon Sep 17 00:00:00 2001 From: julianhansen Date: Tue, 21 Jul 2026 13:27:56 +0200 Subject: [PATCH] Fix: avoid unnecessary pump restart when switching between two active 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. --- custom_components/pentair_cloud/pentaircloud.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/custom_components/pentair_cloud/pentaircloud.py b/custom_components/pentair_cloud/pentaircloud.py index 8669514..0d1d1d4 100644 --- a/custom_components/pentair_cloud/pentaircloud.py +++ b/custom_components/pentair_cloud/pentaircloud.py @@ -408,8 +408,18 @@ def start_program(self, deviceId: str, program_id: int) -> None: + " on device " + deviceId ) - if device.active_program is not None: # Stop previous program - self.stop_program(deviceId, device.active_program) + if device.active_program is not None: + # Live-swap: mark the old program stopped LOCALLY only, without + # sending an explicit stop_program() API call. The pump's own + # firmware handles the transition as a smooth in-place profile + # swap when a new program is enabled directly (confirmed by + # physical observation: the official Pentair app does not stop + # /restart the pump when switching between two running + # programs - only this integration's prior stop-then-start + # sequence forced a hard ~30s restart). + for old_program in device.programs: + if old_program.id == device.active_program: + old_program.running = False device.last_program_start = time.time() self.populate_AWS_token() if self.AWS_TOKEN is not None: