mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 04:08:19 -04:00
Use the action field enums in duotecno (#195603)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user