Use HAVCMode enum in BSB-Lan climate (#94638)

This commit is contained in:
Franck Nijhof 2023-06-15 14:13:20 +02:00 committed by GitHub
parent 908f3386e7
commit 998a45879e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
) )
from homeassistant.util.enum import try_parse_enum
from . import HomeAssistantBSBLANData from . import HomeAssistantBSBLANData
from .const import ATTR_TARGET_TEMPERATURE, DOMAIN, LOGGER from .const import ATTR_TARGET_TEMPERATURE, DOMAIN, LOGGER
@ -112,12 +113,11 @@ class BSBLANClimate(
return float(self.coordinator.data.target_temperature.value) return float(self.coordinator.data.target_temperature.value)
@property @property
def hvac_mode(self) -> str: def hvac_mode(self) -> HVACMode | None:
"""Return hvac operation ie. heat, cool mode.""" """Return hvac operation ie. heat, cool mode."""
if self.coordinator.data.hvac_mode.value == PRESET_ECO: if self.coordinator.data.hvac_mode.value == PRESET_ECO:
return HVACMode.AUTO return HVACMode.AUTO
return try_parse_enum(HVACMode, self.coordinator.data.hvac_mode.value)
return self.coordinator.data.hvac_mode.value
@property @property
def preset_mode(self) -> str | None: def preset_mode(self) -> str | None: