diff --git a/homeassistant/components/overkiz/cover.py b/homeassistant/components/overkiz/cover.py index 1d6db65fee8017..ae48652c33cdae 100644 --- a/homeassistant/components/overkiz/cover.py +++ b/homeassistant/components/overkiz/cover.py @@ -164,6 +164,22 @@ class OverkizCoverDescription(CoverEntityDescription): close_tilt_command_args=(15, 1), # position (1-127), speed (1-15) stop_tilt_command=OverkizCommand.STOP, ), + # Needs override since BioclimaticPergola uses core:SlatsOpenClosedState + # and core:SlateOrientationState (tilt-only, no position) + # uiClass is Pergola + OverkizCoverDescription( + key=UIWidget.BIOCLIMATIC_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, + open_tilt_command=OverkizCommand.OPEN_SLATS, + close_tilt_command=OverkizCommand.CLOSE_SLATS, + stop_tilt_command=OverkizCommand.STOP, + ), # Needs override since PositionableGarageDoor reports # core:OpenClosedUnknownState instead of core:OpenClosedState # uiClass is GarageDoor @@ -371,15 +387,12 @@ class OverkizCoverDescription(CoverEntityDescription): OverkizCoverDescription( key=UIClass.PERGOLA, device_class=CoverDeviceClass.AWNING, + current_position_state=OverkizState.CORE_CLOSURE, + set_position_command=OverkizCommand.SET_CLOSURE, 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, - open_tilt_command=OverkizCommand.OPEN_SLATS, - close_tilt_command=OverkizCommand.CLOSE_SLATS, - stop_tilt_command=OverkizCommand.STOP, + is_closed_state=OverkizState.CORE_OPEN_CLOSED, ), OverkizCoverDescription( key=UIClass.ROLLER_SHUTTER, diff --git a/tests/components/overkiz/fixtures/setup/cloud_somfy_tahoma_v2_europe.json b/tests/components/overkiz/fixtures/setup/cloud_somfy_tahoma_v2_europe.json index 291e2e67074d38..acf036ee2ebe45 100644 --- a/tests/components/overkiz/fixtures/setup/cloud_somfy_tahoma_v2_europe.json +++ b/tests/components/overkiz/fixtures/setup/cloud_somfy_tahoma_v2_europe.json @@ -8305,6 +8305,217 @@ "widget": "DynamicGate", "oid": "a8d3e9f1-4b2c-4d5e-8f6a-1234567890ab", "uiClass": "Gate" + }, + { + "creationTime": 1722449164000, + "lastUpdateTime": 1722449164000, + "label": "Somfy Pergola", + "deviceURL": "ogp://1234-1234-6233/14356699", + "shortcut": false, + "controllableName": "ogp:Pergola", + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "setClosure", + "nparams": 1 + }, + { + "commandName": "stop", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:ClosureState" + }, + { + "type": "DiscreteState", + "values": ["closed", "open"], + "qualifiedName": "core:OpenClosedState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + } + ], + "dataProperties": [], + "widgetName": "DynamicPergola", + "uiProfiles": [ + "StatefulCloseable", + "Closeable", + "StatefulOpenClose", + "OpenClose" + ], + "uiClass": "Pergola", + "qualifiedName": "ogp:Pergola", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:AvailabilityState", + "type": 3, + "value": "available" + }, + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:OpenClosedState", + "type": 3, + "value": "closed" + }, + { + "name": "core:ClosureState", + "type": 1, + "value": 100 + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + } + ], + "available": true, + "enabled": true, + "placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3", + "widget": "DynamicPergola", + "type": 1, + "oid": "60df5650-2d35-4fae-bfff-787521598e7f", + "uiClass": "Pergola" + }, + { + "creationTime": 1633183247000, + "lastUpdateTime": 1633183247000, + "label": "Pergola Awning", + "deviceURL": "io://1234-1234-6233/11447718", + "shortcut": false, + "controllableName": "io:PergolaRailGuidedAwningIOComponent", + "definition": { + "commands": [ + { + "commandName": "deploy", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "setClosure", + "nparams": 1 + }, + { + "commandName": "setDeployment", + "nparams": 1 + }, + { + "commandName": "stop", + "nparams": 0 + }, + { + "commandName": "undeploy", + "nparams": 0 + } + ], + "states": [ + { + "type": "ContinuousState", + "qualifiedName": "core:DeploymentState" + }, + { + "type": "DiscreteState", + "values": ["false", "true"], + "qualifiedName": "core:MovingState" + }, + { + "type": "DiscreteState", + "values": ["closed", "open"], + "qualifiedName": "core:OpenClosedState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:TargetClosureState" + } + ], + "dataProperties": [], + "widgetName": "PergolaHorizontalAwning", + "uiProfiles": [ + "StatefulSlidingPergola", + "StatefulDeployable", + "Deployable", + "DeployUndeploy", + "StatefulOpenClose", + "OpenClose" + ], + "uiClass": "Pergola", + "qualifiedName": "io:PergolaRailGuidedAwningIOComponent", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:DeploymentState", + "type": 1, + "value": 20 + }, + { + "name": "core:OpenClosedState", + "type": 3, + "value": "open" + }, + { + "name": "core:TargetClosureState", + "type": 1, + "value": 20 + }, + { + "name": "core:MovingState", + "type": 6, + "value": false + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + } + ], + "available": true, + "enabled": true, + "placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3", + "widget": "PergolaHorizontalAwning", + "type": 1, + "oid": "71df5650-2d35-4fae-bfff-787521598e7f", + "uiClass": "Pergola" } ], "zones": [], diff --git a/tests/components/overkiz/snapshots/test_cover.ambr b/tests/components/overkiz/snapshots/test_cover.ambr index 29c823d3fc4e0d..3038363dd56125 100644 --- a/tests/components/overkiz/snapshots/test_cover.ambr +++ b/tests/components/overkiz/snapshots/test_cover.ambr @@ -2046,6 +2046,60 @@ 'state': 'closed', }) # --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.pergola_awning-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'cover', + 'entity_category': None, + 'entity_id': 'cover.pergola_awning', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': None, + 'platform': 'overkiz', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'io://1234-1234-6233/11447718', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.pergola_awning-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_position': 20, + 'device_class': 'awning', + 'friendly_name': 'Pergola Awning', + 'is_closed': False, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.pergola_awning', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'open', + }) +# --- # name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.rts_gate-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -2207,6 +2261,60 @@ 'state': 'closed', }) # --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.somfy_pergola-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'cover', + 'entity_category': None, + 'entity_id': 'cover.somfy_pergola', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': None, + 'platform': 'overkiz', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'ogp://1234-1234-6233/14356699', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.somfy_pergola-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_position': 0, + 'device_class': 'awning', + 'friendly_name': 'Somfy Pergola', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.somfy_pergola', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- # name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.studio_shutter-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/overkiz/test_cover.py b/tests/components/overkiz/test_cover.py index 10afa594fb21d0..d99a1c038141fe 100644 --- a/tests/components/overkiz/test_cover.py +++ b/tests/components/overkiz/test_cover.py @@ -154,6 +154,16 @@ "ogp://1234-1234-6233/10410217", "cover.ogp_gate", ) +DYNAMIC_PERGOLA = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "ogp://1234-1234-6233/14356699", + "cover.somfy_pergola", +) +PERGOLA_HORIZONTAL_AWNING = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "io://1234-1234-6233/11447718", + "cover.pergola_awning", +) SNAPSHOT_FIXTURES = [ AWNING, @@ -207,6 +217,14 @@ async def test_cover_entities_snapshot( (CYCLIC_SWINGING_GATE, SERVICE_OPEN_COVER, "cycle", None, CoverState.OPENING), (SLIDING_DISCRETE_GATE, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING), (PARTIAL_GARAGE_DOOR, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING), + (DYNAMIC_PERGOLA, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING), + ( + PERGOLA_HORIZONTAL_AWNING, + SERVICE_OPEN_COVER, + "deploy", + None, + CoverState.OPENING, + ), ( UP_DOWN_BIOCLIMATIC_PERGOLA, SERVICE_OPEN_COVER, @@ -236,6 +254,14 @@ async def test_cover_entities_snapshot( (CYCLIC_SWINGING_GATE, SERVICE_CLOSE_COVER, "cycle", None, CoverState.OPENING), (SLIDING_DISCRETE_GATE, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING), (PARTIAL_GARAGE_DOOR, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING), + (DYNAMIC_PERGOLA, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING), + ( + PERGOLA_HORIZONTAL_AWNING, + SERVICE_CLOSE_COVER, + "undeploy", + None, + CoverState.CLOSING, + ), ( UP_DOWN_BIOCLIMATIC_PERGOLA, SERVICE_CLOSE_COVER, @@ -260,6 +286,14 @@ async def test_cover_entities_snapshot( (DYNAMIC_GATE, SERVICE_STOP_COVER, "stop", None, CoverState.OPEN), (SLIDING_DISCRETE_GATE, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), (PARTIAL_GARAGE_DOOR, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), + (DYNAMIC_PERGOLA, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), + ( + PERGOLA_HORIZONTAL_AWNING, + SERVICE_STOP_COVER, + "stop", + None, + CoverState.OPEN, + ), ( UP_DOWN_BIOCLIMATIC_PERGOLA, SERVICE_STOP_COVER, @@ -346,6 +380,8 @@ async def test_cover_entities_snapshot( "open-cyclic-swinging-gate", "open-sliding-discrete-gate", "open-partial-garage-door", + "open-dynamic-pergola", + "open-pergola-horizontal-awning", "open-up-down-bioclimatic-pergola", "open-tilt-only-venetian-blind", "open-venetian-blind-rts", @@ -361,6 +397,8 @@ async def test_cover_entities_snapshot( "close-cyclic-swinging-gate", "close-sliding-discrete-gate", "close-partial-garage-door", + "close-dynamic-pergola", + "close-pergola-horizontal-awning", "close-up-down-bioclimatic-pergola", "close-tilt-only-venetian-blind", "close-venetian-blind-rts", @@ -373,6 +411,8 @@ async def test_cover_entities_snapshot( "stop-dynamic-gate", "stop-sliding-discrete-gate", "stop-partial-garage-door", + "stop-dynamic-pergola", + "stop-pergola-horizontal-awning", "stop-up-down-bioclimatic-pergola", "stop-tilt-only-venetian-blind", "open-tilt-tilt-only-venetian-blind", @@ -437,8 +477,22 @@ async def test_cover_service_actions( [65, OverkizCommandParam.LOWSPEED], 35, ), + (DYNAMIC_PERGOLA, DYNAMIC_PERGOLA.entity_id, "setClosure", [60], 40), + ( + PERGOLA_HORIZONTAL_AWNING, + PERGOLA_HORIZONTAL_AWNING.entity_id, + "setDeployment", + [80], + 80, + ), + ], + ids=[ + "roller-shutter", + "awning", + "low-speed", + "dynamic-pergola", + "pergola-horizontal-awning", ], - ids=["roller-shutter", "awning", "low-speed"], ) async def test_cover_set_position( hass: HomeAssistant,