Use the action field enums in lightwave (#195942)

This commit is contained in:
epenet
2026-12-02 09:39:40 +02:00
committed by GitHub
parent 227fbbc07c
commit cb7e76887e
2 changed files with 9 additions and 6 deletions
@@ -7,10 +7,11 @@ from homeassistant.components.climate import (
DEFAULT_MIN_TEMP,
ClimateEntity,
ClimateEntityFeature,
ClimateServiceArgument,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, CONF_NAME, UnitOfTemperature
from homeassistant.const import CONF_NAME, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@@ -103,8 +104,10 @@ class LightwaveTrv(ClimateEntity):
@override
def set_temperature(self, **kwargs: Any) -> None:
"""Set TRV target temperature."""
if ATTR_TEMPERATURE in kwargs:
self._attr_native_target_temperature = kwargs[ATTR_TEMPERATURE]
if ClimateServiceArgument.TEMPERATURE in kwargs:
self._attr_native_target_temperature = kwargs[
ClimateServiceArgument.TEMPERATURE
]
self._inhibit = self._attr_native_target_temperature
self._lwlink.set_temperature(
self._device_id, self._attr_native_target_temperature, self._attr_name
+3 -3
View File
@@ -2,7 +2,7 @@
from typing import Any, override
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.components.light import ColorMode, LightEntity, LightServiceArgument
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@@ -52,8 +52,8 @@ class LWRFLight(LightEntity):
"""Turn the LightWave light on."""
self._attr_is_on = True
if ATTR_BRIGHTNESS in kwargs:
self._attr_brightness = kwargs[ATTR_BRIGHTNESS]
if LightServiceArgument.BRIGHTNESS in kwargs:
self._attr_brightness = kwargs[LightServiceArgument.BRIGHTNESS]
if self._attr_brightness != MAX_BRIGHTNESS:
self._lwlink.turn_on_with_brightness(