Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions custom_components/comfoconnect/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ class ComfoconnectSelectEntityDescription(SelectEntityDescription, ComfoconnectS
sensor_value_fn: Callable[[str], Any] = None


async def get_boost_option(ccb):
result = await cast(Coroutine, ccb.get_boost())
return "Off" if not result else result

async def set_boost_option(ccb, option):
if option == "Off":
return await cast(Coroutine, ccb.set_boost(False))
else:
minutes = int(option.split()[0])
return await cast(Coroutine, ccb.set_boost(True, minutes * 60))


SELECT_TYPES = (
ComfoconnectSelectEntityDescription(
key="select_mode",
Expand Down Expand Up @@ -142,9 +154,17 @@ class ComfoconnectSelectEntityDescription(SelectEntityDescription, ComfoconnectS
key="boost_timeout",
name="Boost Mode",
icon="mdi:fan-plus",
get_value_fn=lambda ccb: cast(Coroutine, ccb.get_boost()),
set_value_fn=lambda ccb, option: cast(Coroutine, ccb.set_boost(True, int(option.split()[0]) * 60)),
options=["10 Minutes", "20 Minutes", "30 Minutes", "40 Minutes", "50 Minutes", "60 Minutes"],
get_value_fn=get_boost_option,
set_value_fn=set_boost_option,
options=[
"Off",
"10 Minutes",
"20 Minutes",
"30 Minutes",
"40 Minutes",
"50 Minutes",
"60 Minutes",
],
),
)

Expand Down