Use the action field enums in mill (#195980)

This commit is contained in:
epenet
2026-12-02 12:21:05 +00:00
committed by GitHub
parent eb8d81adcc
commit 2fac304910
+6 -6
View File
@@ -6,13 +6,13 @@ import mill
from mill_local import OperationMode
from homeassistant.components.climate import (
ATTR_HVAC_MODE,
ClimateEntity,
ClimateEntityFeature,
ClimateServiceArgument,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature
from homeassistant.const import PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -68,12 +68,12 @@ class MillHeater(MillBaseEntity, ClimateEntity):
@override
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature and optionally HVAC mode."""
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
if (temperature := kwargs.get(ClimateServiceArgument.TEMPERATURE)) is None:
return
await self.coordinator.mill_data_connection.set_heater_temp(
self._id, float(temperature)
)
if (hvac_mode := kwargs.get(ATTR_HVAC_MODE)) is not None:
if (hvac_mode := kwargs.get(ClimateServiceArgument.HVAC_MODE)) is not None:
await self.async_handle_set_hvac_mode_service(hvac_mode)
else:
await self.coordinator.async_request_refresh()
@@ -151,12 +151,12 @@ class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntit
@override
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature and optionally HVAC mode."""
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
if (temperature := kwargs.get(ClimateServiceArgument.TEMPERATURE)) is None:
return
await self.coordinator.mill_data_connection.set_target_temperature(
float(temperature)
)
if (hvac_mode := kwargs.get(ATTR_HVAC_MODE)) is not None:
if (hvac_mode := kwargs.get(ClimateServiceArgument.HVAC_MODE)) is not None:
await self.async_handle_set_hvac_mode_service(hvac_mode)
else:
await self.coordinator.async_request_refresh()