mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Rename property in Plugwise EntityDescription (#78935)
This commit is contained in:
parent
ddf56baf7a
commit
5c7d40cccf
@ -24,8 +24,8 @@ class PlugwiseSelectDescriptionMixin:
|
|||||||
"""Mixin values for Plugwise Select entities."""
|
"""Mixin values for Plugwise Select entities."""
|
||||||
|
|
||||||
command: Callable[[Smile, str, str], Awaitable[Any]]
|
command: Callable[[Smile, str, str], Awaitable[Any]]
|
||||||
current_option: str
|
current_option_key: str
|
||||||
options: str
|
options_key: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -41,8 +41,8 @@ SELECT_TYPES = (
|
|||||||
name="Thermostat schedule",
|
name="Thermostat schedule",
|
||||||
icon="mdi:calendar-clock",
|
icon="mdi:calendar-clock",
|
||||||
command=lambda api, loc, opt: api.set_schedule_state(loc, opt, STATE_ON),
|
command=lambda api, loc, opt: api.set_schedule_state(loc, opt, STATE_ON),
|
||||||
current_option="selected_schedule",
|
current_option_key="selected_schedule",
|
||||||
options="available_schedules",
|
options_key="available_schedules",
|
||||||
),
|
),
|
||||||
PlugwiseSelectEntityDescription(
|
PlugwiseSelectEntityDescription(
|
||||||
key="select_regulation_mode",
|
key="select_regulation_mode",
|
||||||
@ -50,8 +50,8 @@ SELECT_TYPES = (
|
|||||||
icon="mdi:hvac",
|
icon="mdi:hvac",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
command=lambda api, loc, opt: api.set_regulation_mode(opt),
|
command=lambda api, loc, opt: api.set_regulation_mode(opt),
|
||||||
current_option="regulation_mode",
|
current_option_key="regulation_mode",
|
||||||
options="regulation_modes",
|
options_key="regulation_modes",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -69,7 +69,10 @@ async def async_setup_entry(
|
|||||||
entities: list[PlugwiseSelectEntity] = []
|
entities: list[PlugwiseSelectEntity] = []
|
||||||
for device_id, device in coordinator.data.devices.items():
|
for device_id, device in coordinator.data.devices.items():
|
||||||
for description in SELECT_TYPES:
|
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(
|
entities.append(
|
||||||
PlugwiseSelectEntity(coordinator, device_id, description)
|
PlugwiseSelectEntity(coordinator, device_id, description)
|
||||||
)
|
)
|
||||||
@ -96,12 +99,12 @@ class PlugwiseSelectEntity(PlugwiseEntity, SelectEntity):
|
|||||||
@property
|
@property
|
||||||
def current_option(self) -> str:
|
def current_option(self) -> str:
|
||||||
"""Return the selected entity option to represent the entity state."""
|
"""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
|
@property
|
||||||
def options(self) -> list[str]:
|
def options(self) -> list[str]:
|
||||||
"""Return the selectable entity options."""
|
"""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:
|
async def async_select_option(self, option: str) -> None:
|
||||||
"""Change to the selected entity option."""
|
"""Change to the selected entity option."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user