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