Skip to content

Commit

Permalink
Merge pull request #11 from gdgib/WaterHeater
Browse files Browse the repository at this point in the history
Use operation mode for state, UI & dev docs don't really make sense
  • Loading branch information
gdgib authored May 27, 2024
2 parents 909b9e1 + 4ba3f56 commit 144bfce
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions custom_components/intellicenter/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ async def async_setup_entry(
class PoolWaterHeater(PoolEntity, WaterHeaterEntity, RestoreEntity):
"""Representation of a Pentair water heater."""

LAST_HEATER_ATTR = "LAST_HEATER"
HEATERS_LITS_ATTR = "HEATERS_LIST"
LAST_HEATER_ATTR = "last_heater"
HEATERS_LIST_ATTR = "heaters"
HEATING = "heating"

def __init__(
self,
Expand All @@ -100,7 +101,8 @@ def extra_state_attributes(self) -> Optional[dict[str, Any]]:

state_attributes = super().extra_state_attributes

state_attributes[self.HEATERS_LITS_ATTR] = self._heater_list
state_attributes[self.HEATERS_LIST_ATTR] = self._heater_list
state_attributes[self.HEATING] = STATE_ON if self._poolObject[HTMODE_ATTR] > 0 else STATE_OFF
if self._lastHeater != NULL_OBJNAM:
state_attributes[self.LAST_HEATER_ATTR] = self._lastHeater

Expand All @@ -113,8 +115,7 @@ def state(self) -> str:
heater = self._poolObject[HEATER_ATTR]
if status == "OFF" or heater == NULL_OBJNAM:
return STATE_OFF
htmode = self._poolObject[HTMODE_ATTR]
return STATE_ON if htmode != "0" else STATE_IDLE
return self.current_operation();

@property
def unique_id(self):
Expand Down

0 comments on commit 144bfce

Please sign in to comment.