Skip to content

Commit

Permalink
overkiz: Add select for partial position (garage door)
Browse files Browse the repository at this point in the history
The Somfy Dexxo smart io (io:DiscreteGarageOpenerWithPartialPositionIOComponent)
supports a third position state: partial. This state is meant to be
used to ventilate the garage.

This commit adds a select entity for the position state. The
implementation is very similar to the already existing position state
for gate's with a pedestrian position.

Note: For the updates to work properly, we'd still need
iMicknl/ha-tahoma#167 /
iMicknl/ha-tahoma#271 to be implemented.
See Somfy-Developer/Somfy-TaHoma-Developer-Mode#26
for discussion with Somfy.
  • Loading branch information
fetzerch authored and iMicknl committed Oct 10, 2023
1 parent 60fa02c commit 75a1671
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions homeassistant/components/overkiz/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ def _select_option_open_closed_pedestrian(
)


def _select_option_open_closed_partial(
option: str, execute_command: Callable[..., Awaitable[None]]
) -> Awaitable[None]:
"""Change the selected option for Open/Closed/Partial."""
return execute_command(
{
OverkizCommandParam.CLOSED: OverkizCommand.CLOSE,
OverkizCommandParam.OPEN: OverkizCommand.OPEN,
OverkizCommandParam.PARTIAL: OverkizCommand.PARTIAL_POSITION,
}[OverkizCommandParam(option)]
)


def _select_option_memorized_simple_volume(
option: str, execute_command: Callable[..., Awaitable[None]]
) -> Awaitable[None]:
Expand Down Expand Up @@ -73,6 +86,18 @@ def _select_option_active_zone(
select_option=_select_option_open_closed_pedestrian,
translation_key="open_closed_pedestrian",
),
OverkizSelectDescription(
key=OverkizState.CORE_OPEN_CLOSED_PARTIAL,
name="Position",
icon="mdi:content-save-cog",
options=[
OverkizCommandParam.OPEN,
OverkizCommandParam.PARTIAL,
OverkizCommandParam.CLOSED,
],
select_option=_select_option_open_closed_partial,
translation_key="open_closed_partial",
),
OverkizSelectDescription(
key=OverkizState.IO_MEMORIZED_SIMPLE_VOLUME,
name="Memorized simple volume",
Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/overkiz/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
"closed": "[%key:common::state::closed%]"
}
},
"open_closed_partial": {
"state": {
"open": "[%key:common::state::open%]",
"partial": "Partial",
"closed": "[%key:common::state::closed%]"
}
},
"memorized_simple_volume": {
"state": {
"highest": "Highest",
Expand Down

0 comments on commit 75a1671

Please sign in to comment.