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 committed Sep 28, 2023
1 parent f733c43 commit c9053f7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/overkiz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"integration_type": "hub",
"iot_class": "cloud_polling",
"loggers": ["boto3", "botocore", "pyhumps", "pyoverkiz", "s3transfer"],
"requirements": ["pyoverkiz==1.9.0"],
"requirements": ["pyoverkiz==1.11.0"],
"zeroconf": [
{
"type": "_kizbox._tcp.local.",
Expand Down
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
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ pyotgw==2.1.3
pyotp==2.8.0

# homeassistant.components.overkiz
pyoverkiz==1.9.0
pyoverkiz==1.11.0

# homeassistant.components.openweathermap
pyowm==3.2.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ pyotgw==2.1.3
pyotp==2.8.0

# homeassistant.components.overkiz
pyoverkiz==1.9.0
pyoverkiz==1.11.0

# homeassistant.components.openweathermap
pyowm==3.2.0
Expand Down

0 comments on commit c9053f7

Please sign in to comment.