Use the action field enums in duotecno (#195603)

This commit is contained in:
epenet
2026-11-30 16:39:39 +00:00
committed by GitHub
parent 98b32a4b5c
commit 5282ce2988
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -7,9 +7,10 @@ from duotecno.unit import SensUnit
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
ClimateServiceArgument,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.const import UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -82,7 +83,7 @@ class DuotecnoClimate(DuotecnoEntity, ClimateEntity):
@override
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperatures."""
if (temp := kwargs.get(ATTR_TEMPERATURE)) is None:
if (temp := kwargs.get(ClimateServiceArgument.TEMPERATURE)) is None:
return
await self._unit.set_temp(temp)
+2 -2
View File
@@ -4,7 +4,7 @@ from typing import Any, override
from duotecno.unit import DimUnit
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.components.light import ColorMode, LightEntity, LightServiceArgument
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -46,7 +46,7 @@ class DuotecnoLight(DuotecnoEntity, LightEntity):
@override
async def async_turn_on(self, **kwargs: Any) -> None:
"""Instruct the light to turn on."""
if (val := kwargs.get(ATTR_BRIGHTNESS)) is not None:
if (val := kwargs.get(LightServiceArgument.BRIGHTNESS)) is not None:
# set to a value
val = max(int((val * 100) / 255), 1)
else: