Add cooling / ice-bath support (heat *and* cool) - #5
Open
thorwaler wants to merge 2 commits into
Open
Conversation
Replaces the static cool_mode option with a proper hvac_mode toggle on the climate entity, so heat vs cool can be switched from the frontend (any thermostat/climate card) or an automation, and is persisted. - climate: expose HVACMode.COOL; hvac_mode returns cool when active; hvac_action reports COOLING; async_set_hvac_mode(COOL/HEAT) flips the mode via the coordinator. - coordinator: cool_mode state read from + persisted to options; new set_cool_mode(); direction-aware _thermostat_demand and the two 'target reached' guards. - const: OPT_KEY_COOL_MODE / DEFAULT_COOL_MODE. Setting the climate to 'cool' regulates temperature downward (runs pump/aux when water is ABOVE target); 'heat' is unchanged; persists across restarts.
Changes the hardcoded chlor_spoons unit_of_measurement from German 'Löffel' to 'spoons' so the dosing suggestion reads in English.
Author
|
Companion frontend PR: lweberru/pool_controller_dashboard_frontend#2 — adds the matching cooling display + heat/cool toggle to the card. |
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.
Why
The controller is currently heating-only: it demands heat while water is below
target and treats
water >= targetas "satisfied". For ice baths / cold plunges thegoal is inverted — run the pump + aux output (a chiller) to cool down to a target
that sits below the current water temperature. Today the controller simply does
nothing when the water is too warm.
This PR makes heating/cooling a selectable, persisted
hvac_modeon the climateentity (
heat/cool/off) and inverts the thermostat logic incool.What changed
All temperature decisions flow through one hysteresis helper plus two "target
reached" guards, so the change is small and localised.
const.pyOPT_KEY_COOL_MODE = "cool_mode",DEFAULT_COOL_MODE = False.coordinator.pyself.cool_modefrom options in__init__(next tohvac_enabled).async def set_cool_mode(self, cool)that persists to options, mirroringset_hvac_enabled._thermostat_demand()is now direction-aware:water_temp >= target_temp_effective → demand offguards (PV path and auxpath) are direction-aware — in cool mode "reached" is
water <= target.climate.pyHVACMode.COOLto_attr_hvac_modes.hvac_modereturnsCOOLwhencool_modeis set;hvac_actionreturnsHVACAction.COOLINGwhen active in cool mode.async_set_hvac_mode:COOL→set_cool_mode(True)+ enable;HEAT→set_cool_mode(False)+ enable;OFF→ disable.sensor.py(minor, separate commit — drop if unwanted)chlor_spoonsunit from"Löffel"to"spoons"so the dosesuggestion reads in English.
Behaviour
coolruns the pump + aux (chiller) when water is above target and stops with thesame hysteresis once at/below it.
cool_modeis off (the default).One decision to confirm
I removed the
start_manual_heat_to_target()call from theHEATbranch ofasync_set_hvac_mode. As-is, selectingheatstarts a bathing timer (manualheat-to-target), which is surprising for a plain heat/cool toggle — it turned bathing
mode on every time I switched to heat. Removing it makes
heat/coolsymmetric(continuous thermostat control). If you'd prefer to keep the manual-heat behaviour on
heat, happy to gate it so only the toggle path skips it.Deliberately left heating-tuned (possible follow-ups)
baths, but it overrides cooling below the frost threshold.
Testing
With
coolselected and target a few degrees below water temp: the aux (chiller)switch fires,
hvac_actionreportscooling, and it cuts out once water drops pasttarget with the configured hysteresis. Heating is unchanged with
cool_modeoff.