mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in niko_home_control (#196042)
This commit is contained in:
@@ -9,9 +9,10 @@ from homeassistant.components.climate import (
|
||||
PRESET_ECO,
|
||||
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
|
||||
|
||||
@@ -69,8 +70,10 @@ class NikoHomeControlClimate(NikoHomeControlEntity, ClimateEntity):
|
||||
@override
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if ATTR_TEMPERATURE in kwargs:
|
||||
await self._action.set_temperature(kwargs.get(ATTR_TEMPERATURE))
|
||||
if ClimateServiceArgument.TEMPERATURE in kwargs:
|
||||
await self._action.set_temperature(
|
||||
kwargs.get(ClimateServiceArgument.TEMPERATURE)
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
|
||||
@@ -6,9 +6,9 @@ from nhc.controller import NHCController
|
||||
from nhc.light import NHCLight
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightServiceArgument,
|
||||
brightness_supported,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -53,7 +53,7 @@ class NikoHomeControlLight(NikoHomeControlEntity, LightEntity):
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Instruct the light to turn on."""
|
||||
await self._action.turn_on(kwargs.get(ATTR_BRIGHTNESS))
|
||||
await self._action.turn_on(kwargs.get(LightServiceArgument.BRIGHTNESS))
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
|
||||
Reference in New Issue
Block a user