Add HVACAction state to palazzetti climate (#130502)

This commit is contained in:
dotvav 2024-11-15 16:09:33 +01:00 committed by GitHub
parent cd79a606d7
commit 58087d67d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -7,6 +7,7 @@ from pypalazzetti.exceptions import CommunicationError, ValidationError
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
@ -82,8 +83,16 @@ class PalazzettiClimateEntity(
@property
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat or off mode."""
is_heating = bool(self.coordinator.client.is_heating)
return HVACMode.HEAT if is_heating else HVACMode.OFF
return HVACMode.HEAT if self.coordinator.client.is_on else HVACMode.OFF
@property
def hvac_action(self) -> HVACAction:
"""Return hvac action ie. heating or idle."""
return (
HVACAction.HEATING
if self.coordinator.client.is_heating
else HVACAction.IDLE
)
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target hvac mode."""

View File

@ -66,6 +66,7 @@
'auto',
]),
'friendly_name': 'Stove',
'hvac_action': <HVACAction.HEATING: 'heating'>,
'hvac_modes': list([
<HVACMode.HEAT: 'heat'>,
<HVACMode.OFF: 'off'>,