mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in nibe_heatpump (#196041)
This commit is contained in:
@@ -13,12 +13,9 @@ from nibe.coil_groups import (
|
||||
from nibe.exceptions import CoilNotFoundException
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_HVAC_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
ATTR_TEMPERATURE,
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
ClimateServiceArgument,
|
||||
HVACAction,
|
||||
HVACMode,
|
||||
)
|
||||
@@ -205,9 +202,9 @@ class NibeClimateEntity(CoordinatorEntity[CoilCoordinator], ClimateEntity):
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set target temperatures."""
|
||||
coordinator = self.coordinator
|
||||
hvac_mode = kwargs.get(ATTR_HVAC_MODE, self._attr_hvac_mode)
|
||||
hvac_mode = kwargs.get(ClimateServiceArgument.HVAC_MODE, self._attr_hvac_mode)
|
||||
|
||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is not None:
|
||||
if (temperature := kwargs.get(ClimateServiceArgument.TEMPERATURE)) is not None:
|
||||
if hvac_mode == HVACMode.HEAT:
|
||||
await coordinator.async_write_coil(
|
||||
self._coil_setpoint_heat, temperature
|
||||
@@ -228,12 +225,15 @@ class NibeClimateEntity(CoordinatorEntity[CoilCoordinator], ClimateEntity):
|
||||
" 'heat' or 'cool'"
|
||||
)
|
||||
|
||||
if (temperature := kwargs.get(ATTR_TARGET_TEMP_LOW)) is not None:
|
||||
if (
|
||||
temperature := kwargs.get(ClimateServiceArgument.TARGET_TEMP_LOW)
|
||||
) is not None:
|
||||
await coordinator.async_write_coil(self._coil_setpoint_heat, temperature)
|
||||
|
||||
if (
|
||||
self._coil_setpoint_cool
|
||||
and (temperature := kwargs.get(ATTR_TARGET_TEMP_HIGH)) is not None
|
||||
and (temperature := kwargs.get(ClimateServiceArgument.TARGET_TEMP_HIGH))
|
||||
is not None
|
||||
):
|
||||
await coordinator.async_write_coil(self._coil_setpoint_cool, temperature)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user