From 7ad528f76588e9565845ef6dee0668cca14dcbaf Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 27 Nov 2026 07:52:39 +0100 Subject: [PATCH] Use the action field enums in bond (#194880) --- homeassistant/components/bond/cover.py | 6 ++++-- homeassistant/components/bond/light.py | 13 ++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/bond/cover.py b/homeassistant/components/bond/cover.py index f16b2c1399d2..867b82769618 100644 --- a/homeassistant/components/bond/cover.py +++ b/homeassistant/components/bond/cover.py @@ -5,10 +5,10 @@ from typing import Any, override from bond_async import Action, DeviceType from homeassistant.components.cover import ( - ATTR_POSITION, CoverDeviceClass, CoverEntity, CoverEntityFeature, + CoverServiceArgument, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -82,7 +82,9 @@ class BondCover(BondEntity, CoverEntity): """Set the cover position.""" await self._bond.action( self._device_id, - Action.set_position(_hass_to_bond_position(kwargs[ATTR_POSITION])), + Action.set_position( + _hass_to_bond_position(kwargs[CoverServiceArgument.POSITION]) + ), ) @override diff --git a/homeassistant/components/bond/light.py b/homeassistant/components/bond/light.py index 59c38425cb5d..36215791e35d 100644 --- a/homeassistant/components/bond/light.py +++ b/homeassistant/components/bond/light.py @@ -6,12 +6,7 @@ from typing import Any, override from aiohttp.client_exceptions import ClientResponseError from bond_async import Action, DeviceType -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_COLOR_TEMP_KELVIN, - ColorMode, - LightEntity, -) +from homeassistant.components.light import ColorMode, LightEntity, LightServiceArgument from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity import Entity @@ -155,14 +150,14 @@ class BondLight(BondBaseLight, BondEntity, LightEntity): """Turn on the light.""" basic_on = True - if brightness := kwargs.get(ATTR_BRIGHTNESS): + if brightness := kwargs.get(LightServiceArgument.BRIGHTNESS): await self._bond.action( self._device_id, Action.set_brightness(round((brightness * 100) / 255)), ) basic_on = False - if color_temp := kwargs.get(ATTR_COLOR_TEMP_KELVIN): + if color_temp := kwargs.get(LightServiceArgument.COLOR_TEMP_KELVIN): await self._bond.action( self._device_id, # API resolution is 100K @@ -274,7 +269,7 @@ class BondFireplace(BondEntity, LightEntity): """Turn the fireplace on.""" _LOGGER.debug("Fireplace async_turn_on called with: %s", kwargs) - if brightness := kwargs.get(ATTR_BRIGHTNESS): + if brightness := kwargs.get(LightServiceArgument.BRIGHTNESS): flame = round((brightness * 100) / 255) await self._bond.action(self._device_id, Action.set_flame(flame)) else: