Add Per-Circuit Pump Speed Control via NumberEntity Sliders#66
Open
celestinjr wants to merge 3 commits into
Open
Add Per-Circuit Pump Speed Control via NumberEntity Sliders#66celestinjr wants to merge 3 commits into
celestinjr wants to merge 3 commits into
Conversation
…nd==10 PumpOnSensor relied on command==10 to determine if a pump is running. This is incorrect for Regal Modbus pumps, which emit command=4 while actively running (e.g. rpm=3450, watts=1406, command=4), causing the running state sensor to incorrectly toggle off/on with each state update. Fix: for non-relay pumps, use rpm>0 or watts>0 as the running indicator. Relay-based pumps retain existing relay>0 logic. Aligns with the same fix applied in nodejs-poolController-dashPanel.
Implement intelligent throttling for high-frequency push-driven sensors across the integration (pump, temperature, filter sensors). Reduces HomeAssistant/InfluxDB writes while preserving responsiveness through configurable delta-based and binary throttling modes. Also fixes PumpSpeedSensor max_speed scalar bug.
- Add pumpExt Socket.IO event listener to receive extended pump data with circuits - Add EVENT_PUMP_EXT and API_PUMP_CIRCUIT constants - Implement PumpCircuitSpeedNumber(NumberEntity) for variable-speed pump circuits - One entity per circuit per pump that supports speed/flow control - RPM mode (default) or GPM mode based on circuit units field - Uses PUT /config/pumpCircuit API to set speed/flow - Slider mode UI for intuitive adjustment - Listens to pumpExt events for push updates from external changes - Optimistic updates for responsive UX - Wire up entity creation in number.py to iterate pump circuits - Add comprehensive TDD test suite (40 tests) covering: - Initialization and property mapping - RPM vs GPM unit handling - API calls with correct payload structure - Coordinator updates via pumpExt event - Availability handling - Edge cases (missing circuits, empty arrays, wrong pump/circuit IDs) - All 71 tests passing with zero regressions
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.
Description
This PR adds per-circuit speed/flow control for variable-speed pumps in the njsPC-HA custom integration. Users can now adjust individual pump circuit speeds (RPM) or flow rates (GPM) directly from Home Assistant using slider controls.
Changes
Core Implementation:
custom_components/njspc_ha/pumps.py — New
PumpCircuitSpeedNumberentity class:PoolEquipmentEntityandNumberEntityfor per-circuit speed/flow controlasync_set_native_value()to send commands viaconfig/pumpCircuitAPI endpointpumpExtevents without pollingcustom_components/njspc_ha/init.py — Coordinator updates:
pumpExtevent to receive extended pump/circuit datacustom_components/njspc_ha/const.py — New constants:
API_PUMP_CIRCUIT = "config/pumpCircuit"— API endpoint for setting speed/flowEVENT_PUMP_EXT = "pumpExt"— Socket event for extended pump circuit datacustom_components/njspc_ha/number.py — Platform setup:
PumpCircuitSpeedNumberfor each pump circuit that supports speed or flow controlmaxSpeedormaxFlowcapabilitiesTests (tests/test_pump_circuit_speed.py):
pumpExteventsFeatures
✅ RPM Control — For variable-speed pumps with speed control
✅ Flow Control — For pumps reporting flow in GPM
✅ Slider UI — Home Assistant number entity slider for intuitive control
✅ Live Updates — State updates from
pumpExtevents without polling✅ Constraints — Respects pump min/max speeds and step sizes
✅ Multi-Circuit — Each pump circuit gets independent control entity
✅ Availability — Gracefully handles connection loss
Testing Checklist
pytest tests/test_pump_circuit_speed.py -vconfig/pumpCircuitAPI callsBreaking Changes
None — this is purely additive functionality.
Dependencies
Depends on #62. Please merge that fix first for cleaner history.
Related Issues
None