mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Use the action field enums in iaqualink (#195786)
This commit is contained in:
@@ -9,10 +9,11 @@ from iaqualink.systems.iaqua.device import AqualinkState
|
||||
from homeassistant.components.climate import (
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
ClimateServiceArgument,
|
||||
HVACAction,
|
||||
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
|
||||
|
||||
@@ -110,7 +111,7 @@ class HassAqualinkThermostat(AqualinkEntity[AqualinkThermostat], ClimateEntity):
|
||||
await await_or_reraise(
|
||||
self.hass,
|
||||
self.coordinator.config_entry,
|
||||
self.dev.set_temperature(int(kwargs[ATTR_TEMPERATURE])),
|
||||
self.dev.set_temperature(int(kwargs[ClimateServiceArgument.TEMPERATURE])),
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
@@ -5,11 +5,10 @@ from typing import Any, override
|
||||
from iaqualink.device import AqualinkLight
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_EFFECT,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityFeature,
|
||||
LightServiceArgument,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
@@ -68,13 +67,13 @@ class HassAqualinkLight(AqualinkEntity[AqualinkLight], LightEntity):
|
||||
them.
|
||||
"""
|
||||
# For now I'm assuming lights support either effects or brightness.
|
||||
if effect_name := kwargs.get(ATTR_EFFECT):
|
||||
if effect_name := kwargs.get(LightServiceArgument.EFFECT):
|
||||
await await_or_reraise(
|
||||
self.hass,
|
||||
self.coordinator.config_entry,
|
||||
self.dev.set_effect_by_name(effect_name),
|
||||
)
|
||||
elif brightness := kwargs.get(ATTR_BRIGHTNESS):
|
||||
elif brightness := kwargs.get(LightServiceArgument.BRIGHTNESS):
|
||||
# Aqualink supports percentages in 25% increments.
|
||||
pct = round(brightness * 4.0 / 255) * 25
|
||||
await await_or_reraise(
|
||||
|
||||
Reference in New Issue
Block a user