Use the action field enums in eheimdigital (#195621)

This commit is contained in:
epenet
2026-11-30 17:24:32 +00:00
committed by GitHub
parent ff69ceadc4
commit 0845278aec
2 changed files with 17 additions and 14 deletions
@@ -10,15 +10,11 @@ from homeassistant.components.climate import (
PRESET_NONE,
ClimateEntity,
ClimateEntityFeature,
ClimateServiceArgument,
HVACAction,
HVACMode,
)
from homeassistant.const import (
ATTR_TEMPERATURE,
PRECISION_HALVES,
PRECISION_TENTHS,
UnitOfTemperature,
)
from homeassistant.const import PRECISION_HALVES, PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -95,8 +91,10 @@ class EheimDigitalHeaterClimate(EheimDigitalEntity[EheimDigitalHeater], ClimateE
@override
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set a new temperature."""
if ATTR_TEMPERATURE in kwargs:
await self._device.set_target_temperature(kwargs[ATTR_TEMPERATURE])
if ClimateServiceArgument.TEMPERATURE in kwargs:
await self._device.set_target_temperature(
kwargs[ClimateServiceArgument.TEMPERATURE]
)
@exception_handler
@override
+11 -6
View File
@@ -7,12 +7,11 @@ from eheimdigital.device import EheimDigitalDevice
from eheimdigital.types import LightMode
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
EFFECT_OFF,
ColorMode,
LightEntity,
LightEntityFeature,
LightServiceArgument,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
@@ -92,12 +91,18 @@ class EheimDigitalClassicLEDControlLight(
@override
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
if ATTR_EFFECT in kwargs:
await self._device.set_light_mode(EFFECT_TO_LIGHT_MODE[kwargs[ATTR_EFFECT]])
if LightServiceArgument.EFFECT in kwargs:
await self._device.set_light_mode(
EFFECT_TO_LIGHT_MODE[kwargs[LightServiceArgument.EFFECT]]
)
return
if ATTR_BRIGHTNESS in kwargs:
if LightServiceArgument.BRIGHTNESS in kwargs:
await self._device.turn_on(
int(brightness_to_value(BRIGHTNESS_SCALE, kwargs[ATTR_BRIGHTNESS])),
int(
brightness_to_value(
BRIGHTNESS_SCALE, kwargs[LightServiceArgument.BRIGHTNESS]
)
),
self._channel,
)