Skip to content

Commit

Permalink
Restore old min temperature, but use the pack config data if availabl…
Browse files Browse the repository at this point in the history
…e to override.
  • Loading branch information
gazoodle committed Mar 4, 2025
1 parent 0a18f91 commit 5071718
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ https://www.gnu.org/licenses/gpl-3.0.html
- Fixed broken EcoMode switch that 1.0.8 introduced
- Added pump and blower sensors to show P<n> & BL device states because buttons now
exclusively use UdP<n> for control.
- Restore old min temperature, but use the pack config data if available to override.

## Done/Fixed in 1.0.8
- Snapshots can be a full JSON file now
Expand Down
26 changes: 24 additions & 2 deletions src/geckolib/automation/heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def max_temp(self) -> float:
class GeckoWaterHeater(GeckoWaterHeaterAbstract):
"""Water Heater object based on Home Assistant Entity Type Climate."""

MIN_TEMP_C = 8
MIN_TEMP_C = 15
MAX_TEMP_C = 40
MIN_TEMP_F = 46
MIN_TEMP_F = 59
MAX_TEMP_F = 104

def __init__(self, facade: GeckoAsyncFacade) -> None:
Expand All @@ -69,6 +69,8 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
self._temperature_unit_accessor = None
self._heating_action_sensor = None
self._cooling_action_sensor = None
self._min_temp_sensor = None
self._max_temp_sensor = None

# Attempt to locate the various items needed from the spa accessors
self._temperature_unit_accessor = self._spa.accessors[
Expand Down Expand Up @@ -110,6 +112,20 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
"Cooling",
self._spa.accessors[GeckoConstants.KEY_COOLINGDOWN],
)
if GeckoConstants.KEY_MIN_SETPOINT_G in self._spa.accessors:
self._min_temp_sensor = GeckoSensor(
self.facade,
"Min Temperature",
self._spa.accessors[GeckoConstants.KEY_MIN_SETPOINT_G],
self._temperature_unit_accessor,
)
if GeckoConstants.KEY_MAX_SETPOINT_G in self._spa.accessors:
self._max_temp_sensor = GeckoSensor(
self.facade,
"Max Temperature",
self._spa.accessors[GeckoConstants.KEY_MAX_SETPOINT_G],
self._temperature_unit_accessor,
)

# Setup change observers
for sensor in [
Expand All @@ -119,6 +135,8 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
self._temperature_unit_accessor,
self._heating_action_sensor,
self._cooling_action_sensor,
self._min_temp_sensor,
self._max_temp_sensor,
]:
if sensor is not None:
sensor.watch(self._on_change)
Expand Down Expand Up @@ -152,6 +170,8 @@ def real_target_temperature_sensor(self) -> GeckoSensor:
@property
def min_temp(self) -> float:
"""Get the minimum temperature of the water heater."""
if self._min_temp_sensor is not None:
return self._min_temp_sensor.state
return (
self.MIN_TEMP_C
if self._temperature_unit_accessor.value == "C"
Expand All @@ -161,6 +181,8 @@ def min_temp(self) -> float:
@property
def max_temp(self) -> float:
"""Get the maximum temperature of the water heater."""
if self._max_temp_sensor is not None:
return self._max_temp_sensor.state
return (
self.MAX_TEMP_C
if self._temperature_unit_accessor.value == "C"
Expand Down

0 comments on commit 5071718

Please sign in to comment.