Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions homeassistant/components/overkiz/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ class OverkizCoverDescription(CoverEntityDescription):
OverkizCoverDescription(
key=UIClass.PERGOLA,
device_class=CoverDeviceClass.AWNING,
open_command=OverkizCommand.OPEN,
close_command=OverkizCommand.CLOSE,
stop_command=OverkizCommand.STOP,
is_closed_state=OverkizState.CORE_SLATS_OPEN_CLOSED,
current_tilt_position_state=OverkizState.CORE_SLATE_ORIENTATION,
set_tilt_position_command=OverkizCommand.SET_ORIENTATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,71 @@
"uiClass": "Pergola"
}
},
{
"deviceURL": "rts://1234-5678-3293/16757826",
"available": true,
"synced": true,
"type": 1,
"states": [],
"label": "Kitchen Pergola",
"subsystemId": 0,
"attributes": [],
"enabled": true,
"controllableName": "rts:BioclimaticPergolaRTSComponent",
"definition": {
"states": [],
"widgetName": "UpDownBioclimaticPergola",
"type": "ACTUATOR",
"attributes": [],
"commands": [
{
"commandName": "identify",
"nparams": 0
},
{
"nparams": 2,
"commandName": "tiltPositive",
"paramsSig": "p1,p2"
},
{
"nparams": 0,
"commandName": "my",
"paramsSig": "*p1"
},
{
"nparams": 0,
"commandName": "stop",
"paramsSig": "*p1"
},
{
"nparams": 2,
"commandName": "tiltNegative",
"paramsSig": "p1,p2"
},
{
"nparams": 0,
"commandName": "close",
"paramsSig": "*p1"
},
{
"nparams": 0,
"commandName": "down",
"paramsSig": "*p1"
},
{
"nparams": 0,
"commandName": "open",
"paramsSig": "*p1"
},
{
"nparams": 0,
"commandName": "up",
"paramsSig": "*p1"
}
],
"uiClass": "Pergola"
}
},
{
"creationTime": 1686173907452,
"deviceURL": "rts://1234-5678-3293/16757362",
Expand Down
54 changes: 54 additions & 0 deletions tests/components/overkiz/snapshots/test_cover.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3090,6 +3090,60 @@
'state': 'closed',
})
# ---
# name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.kitchen_pergola-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'cover',
'entity_category': None,
'entity_id': 'cover.kitchen_pergola',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <CoverDeviceClass.AWNING: 'awning'>,
'original_icon': None,
'original_name': None,
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': <CoverEntityFeature: 11>,
'translation_key': None,
'unique_id': 'rts://1234-5678-3293/16757826',
'unit_of_measurement': None,
})
# ---
# name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.kitchen_pergola-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'assumed_state': True,
'device_class': 'awning',
'friendly_name': 'Kitchen Pergola',
'is_closed': None,
'supported_features': <CoverEntityFeature: 11>,
}),
'context': <ANY>,
'entity_id': 'cover.kitchen_pergola',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.living_room_curtain-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
Expand Down
60 changes: 48 additions & 12 deletions tests/components/overkiz/test_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
CoverEntityFeature,
CoverState,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNAVAILABLE, Platform
from homeassistant.const import (
ATTR_ENTITY_ID,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import entity_registry as er
Expand All @@ -52,6 +57,11 @@
"io://1234-5678-3293/7614902",
"cover.garden_pergola",
)
UP_DOWN_BIOCLIMATIC_PERGOLA = FixtureDevice(
"setup/local_somfy_tahoma_v2_europe.json",
"rts://1234-5678-3293/16757826",
"cover.kitchen_pergola",
)
RTS = FixtureDevice(
"setup/cloud_somfy_connexoon_rts_asia.json",
"rts://1234-1234-6362/16730022",
Expand Down Expand Up @@ -129,28 +139,52 @@ async def test_cover_entities_snapshot(


@pytest.mark.parametrize(
("device", "service", "command_name", "expected_state"),
("device", "service", "command_name", "parameters", "expected_state"),
[
(SHUTTER, SERVICE_OPEN_COVER, "open", CoverState.OPENING),
(AWNING, SERVICE_OPEN_COVER, "deploy", CoverState.OPENING),
(GARAGE, SERVICE_OPEN_COVER, "open", CoverState.OPENING),
(SHUTTER, SERVICE_CLOSE_COVER, "close", CoverState.CLOSING),
(AWNING, SERVICE_CLOSE_COVER, "undeploy", CoverState.CLOSING),
(GARAGE, SERVICE_CLOSE_COVER, "close", CoverState.CLOSING),
(SHUTTER, SERVICE_STOP_COVER, "stop", CoverState.CLOSED),
(AWNING, SERVICE_STOP_COVER, "stop", CoverState.CLOSED),
(GARAGE, SERVICE_STOP_COVER, "stop", CoverState.CLOSED),
(SHUTTER, SERVICE_OPEN_COVER, "open", [], CoverState.OPENING),
(AWNING, SERVICE_OPEN_COVER, "deploy", [], CoverState.OPENING),
(GARAGE, SERVICE_OPEN_COVER, "open", [], CoverState.OPENING),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
SERVICE_OPEN_COVER,
"open",
[0],
CoverState.OPENING,
),
(SHUTTER, SERVICE_CLOSE_COVER, "close", [], CoverState.CLOSING),
(AWNING, SERVICE_CLOSE_COVER, "undeploy", [], CoverState.CLOSING),
(GARAGE, SERVICE_CLOSE_COVER, "close", [], CoverState.CLOSING),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
SERVICE_CLOSE_COVER,
"close",
[0],
CoverState.CLOSING,
),
(SHUTTER, SERVICE_STOP_COVER, "stop", [], CoverState.CLOSED),
(AWNING, SERVICE_STOP_COVER, "stop", [], CoverState.CLOSED),
(GARAGE, SERVICE_STOP_COVER, "stop", [], CoverState.CLOSED),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
SERVICE_STOP_COVER,
"stop",
[0],
STATE_UNKNOWN,
),
],
ids=[
"open-roller-shutter",
"open-awning",
"open-garage-door",
"open-up-down-bioclimatic-pergola",
"close-roller-shutter",
"close-awning",
"close-garage-door",
"close-up-down-bioclimatic-pergola",
"stop-roller-shutter",
"stop-awning",
"stop-garage-door",
"stop-up-down-bioclimatic-pergola",
],
)
async def test_cover_service_actions(
Expand All @@ -160,7 +194,8 @@ async def test_cover_service_actions(
device: FixtureDevice,
service: str,
command_name: str,
expected_state: CoverState,
parameters: list[Any],
expected_state: CoverState | str,
) -> None:
"""Test open, close, and stop cover services."""
await setup_overkiz_integration(fixture=device.fixture)
Expand All @@ -179,6 +214,7 @@ async def test_cover_service_actions(
mock_client,
device_url=device.device_url,
command_name=command_name,
parameters=parameters,
)


Expand Down
Loading