From 5c7d40cccf473c3549900949fe410dbe9d2e1a19 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 22 Sep 2022 18:55:57 +0200 Subject: [PATCH] Rename property in Plugwise EntityDescription (#78935) --- homeassistant/components/plugwise/select.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/plugwise/select.py b/homeassistant/components/plugwise/select.py index 7afe76e1a8a..989f56adcf3 100644 --- a/homeassistant/components/plugwise/select.py +++ b/homeassistant/components/plugwise/select.py @@ -24,8 +24,8 @@ class PlugwiseSelectDescriptionMixin: """Mixin values for Plugwise Select entities.""" command: Callable[[Smile, str, str], Awaitable[Any]] - current_option: str - options: str + current_option_key: str + options_key: str @dataclass @@ -41,8 +41,8 @@ SELECT_TYPES = ( name="Thermostat schedule", icon="mdi:calendar-clock", command=lambda api, loc, opt: api.set_schedule_state(loc, opt, STATE_ON), - current_option="selected_schedule", - options="available_schedules", + current_option_key="selected_schedule", + options_key="available_schedules", ), PlugwiseSelectEntityDescription( key="select_regulation_mode", @@ -50,8 +50,8 @@ SELECT_TYPES = ( icon="mdi:hvac", entity_category=EntityCategory.CONFIG, command=lambda api, loc, opt: api.set_regulation_mode(opt), - current_option="regulation_mode", - options="regulation_modes", + current_option_key="regulation_mode", + options_key="regulation_modes", ), ) @@ -69,7 +69,10 @@ async def async_setup_entry( entities: list[PlugwiseSelectEntity] = [] for device_id, device in coordinator.data.devices.items(): for description in SELECT_TYPES: - if description.options in device and len(device[description.options]) > 1: + if ( + description.options_key in device + and len(device[description.options_key]) > 1 + ): entities.append( PlugwiseSelectEntity(coordinator, device_id, description) ) @@ -96,12 +99,12 @@ class PlugwiseSelectEntity(PlugwiseEntity, SelectEntity): @property def current_option(self) -> str: """Return the selected entity option to represent the entity state.""" - return self.device[self.entity_description.current_option] + return self.device[self.entity_description.current_option_key] @property def options(self) -> list[str]: """Return the selectable entity options.""" - return self.device[self.entity_description.options] + return self.device[self.entity_description.options_key] async def async_select_option(self, option: str) -> None: """Change to the selected entity option."""