Skip to content

Commit

Permalink
Bump verson
Browse files Browse the repository at this point in the history
Update README
Handle TempNotValid error
Make sure Error sensor updates if any underlying accessor changes
  • Loading branch information
gazoodle committed Mar 4, 2025
1 parent 07ce56b commit d74e998
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ https://www.gnu.org/licenses/gpl-3.0.html
- Keep looking to see if there is a time sync mechanism
- Use the config ver and status ver check in simulator to make sure partial block updates are acceptable

## Done/Fixed in 1.0.10
- Handle TempNotValid error

## Done/Fixed in 1.0.9
- Fixed broken EcoMode switch that 1.0.8 introduced
- Added pump and blower sensors to show P<n> & BL device states because buttons now
Expand Down
2 changes: 1 addition & 1 deletion src/geckolib/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Single module version."""

VERSION = "1.0.9"
VERSION = "1.0.10"
22 changes: 21 additions & 1 deletion src/geckolib/automation/heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from __future__ import annotations

import logging
from abc import abstractmethod
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

from geckolib.automation.power import GeckoPower
from geckolib.const import GeckoConstants
Expand All @@ -13,6 +14,8 @@
if TYPE_CHECKING:
from geckolib.automation.async_facade import GeckoAsyncFacade

_LOGGER = logging.getLogger(__name__)


class GeckoWaterHeaterAbstract(GeckoPower):
"""Abstract base for water heaters."""
Expand Down Expand Up @@ -71,6 +74,7 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
self._cooling_action_sensor = None
self._min_temp_sensor = None
self._max_temp_sensor = None
self._temp_not_valid_sensor = None

# Attempt to locate the various items needed from the spa accessors
self._temperature_unit_accessor = self._spa.accessors[
Expand Down Expand Up @@ -126,6 +130,12 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
self._spa.accessors[GeckoConstants.KEY_MAX_SETPOINT_G],
self._temperature_unit_accessor,
)
if GeckoConstants.KEY_TEMP_NOT_VALID in self._spa.accessors:
self._temp_not_valid_sensor = GeckoSensor(
self.facade,
"Temp Not Valid",
self._spa.accessors[GeckoConstants.KEY_TEMP_NOT_VALID],
)

# Setup change observers
for sensor in [
Expand All @@ -137,10 +147,13 @@ def __init__(self, facade: GeckoAsyncFacade) -> None:
self._cooling_action_sensor,
self._min_temp_sensor,
self._max_temp_sensor,
self._temp_not_valid_sensor,
]:
if sensor is not None:
sensor.watch(self._on_change)

self._on_change(None, None, None)

@property
def target_temperature_sensor(self) -> GeckoSensor:
"""Get the target temperature sensor object."""
Expand Down Expand Up @@ -262,6 +275,13 @@ def __str__(self) -> str:
)
return f"{self.name}: Not present"

def _on_change(
self, sender: Any = None, old_value: Any = None, new_value: Any = None
) -> None:
if self._temp_not_valid_sensor is not None:
self.set_availability(is_available=not self._temp_not_valid_sensor.state)
return super()._on_change(sender, old_value, new_value)

@property
def monitor(self) -> str:
"""Get monitor string."""
Expand Down
2 changes: 2 additions & 0 deletions src/geckolib/automation/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,5 @@ def update_state(
_LOGGER.debug("Error sensor state is %s", self.state)
else:
self._state = "None"

self._on_change(None, None, None)
1 change: 1 addition & 0 deletions src/geckolib/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class GeckoConstants:
KEY_DISPLAYED_TEMP_G = "DisplayedTempG"
KEY_HEATING = "Heating"
KEY_COOLINGDOWN = "CoolingDown"
KEY_TEMP_NOT_VALID = "TempNotValid"
KEY_PUMP_1 = "P1"
KEY_PUMP_2 = "P2"
KEY_PUMP_3 = "P3"
Expand Down

0 comments on commit d74e998

Please sign in to comment.