diff --git a/homeassistant/components/overkiz/cover.py b/homeassistant/components/overkiz/cover.py index 9eb3b3d079d8c..ca8057fd389d2 100644 --- a/homeassistant/components/overkiz/cover.py +++ b/homeassistant/components/overkiz/cover.py @@ -124,6 +124,32 @@ class OverkizCoverDescription(CoverEntityDescription): close_tilt_command_args=(15, 1), # position (1-127), speed (1-15) stop_tilt_command=OverkizCommand.STOP, ), + # Needs override since PositionableGarageDoor reports + # core:OpenClosedUnknownState instead of core:OpenClosedState + # uiClass is GarageDoor + OverkizCoverDescription( + key=UIWidget.POSITIONABLE_GARAGE_DOOR, + device_class=CoverDeviceClass.GARAGE, + 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_OPEN_CLOSED_UNKNOWN, + ), + # Needs override since PositionableGarageDoorWithPartialPosition reports + # core:OpenClosedPartialState instead of core:OpenClosedState + # uiClass is GarageDoor + OverkizCoverDescription( + key=UIWidget.POSITIONABLE_GARAGE_DOOR_WITH_PARTIAL_POSITION, + device_class=CoverDeviceClass.GARAGE, + 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_OPEN_CLOSED_PARTIAL, + ), # Needs override to support this Generic device (rts:GenericRTSComponent) # uiClass is Generic (not mapped to cover as this is a Generic device class) OverkizCoverDescription( @@ -200,7 +226,7 @@ class OverkizCoverDescription(CoverEntityDescription): set_position_command=OverkizCommand.SET_CLOSURE, open_command=OverkizCommand.OPEN, close_command=OverkizCommand.CLOSE, - is_closed_state=OverkizState.CORE_OPEN_CLOSED_UNKNOWN, + is_closed_state=OverkizState.CORE_OPEN_CLOSED, stop_command=OverkizCommand.STOP, ), OverkizCoverDescription( 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 b20d0c4c58b99..767327d82d360 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 @@ -7370,6 +7370,238 @@ "widget": "DiscreteGateWithPedestrianPosition", "oid": "6ba9b1de-8037-41d7-9150-21f7d5f49a3f", "uiClass": "Gate" + }, + { + "creationTime": 1521964729000, + "lastUpdateTime": 1521964729000, + "label": "Garage Door", + "deviceURL": "io://1234-1234-6233/16730050", + "shortcut": false, + "controllableName": "io:DynamicGarageDoorComponent", + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "stop", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["closed", "open"], + "qualifiedName": "core:OpenClosedState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + } + ], + "widgetName": "DynamicGarageDoor", + "uiProfiles": ["OpenClose"], + "uiClass": "GarageDoor", + "qualifiedName": "io:DynamicGarageDoorComponent", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:OpenClosedState", + "type": 3, + "value": "closed" + }, + { + "name": "core:StatusState", + "type": 3, + "value": "available" + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + } + ], + "available": true, + "enabled": true, + "placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3", + "widget": "DynamicGarageDoor", + "type": 1, + "oid": "a5d47351-52d0-4a4c-a52d-abcdef123456", + "uiClass": "GarageDoor" + }, + { + "creationTime": 1521964729000, + "lastUpdateTime": 1521964729000, + "label": "OGP Garage Door", + "deviceURL": "ogp://1234-1234-6233/6632544", + "shortcut": false, + "controllableName": "ogp:GarageDoor", + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "stop", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "DiscreteState", + "values": ["closed", "open"], + "qualifiedName": "core:OpenClosedState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + } + ], + "widgetName": "DynamicGarageDoor", + "uiProfiles": ["StatefulOpenClose", "OpenClose"], + "uiClass": "GarageDoor", + "qualifiedName": "ogp:GarageDoor", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:AvailabilityState", + "type": 3, + "value": "available" + }, + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:OpenClosedState", + "type": 3, + "value": "closed" + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + }, + { + "name": "core:Technology", + "type": 3, + "value": "io2way" + } + ], + "available": true, + "enabled": true, + "placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3", + "widget": "DynamicGarageDoor", + "type": 1, + "oid": "2492f7ae-3711-4160-9dae-e8910b708ce1", + "uiClass": "GarageDoor" + }, + { + "creationTime": 1521964729000, + "lastUpdateTime": 1521964729000, + "label": "Partial Garage Door", + "deviceURL": "io://1234-1234-6233/7433515", + "shortcut": false, + "controllableName": "io:DiscreteGarageOpenerWithPartialPositionIOComponent", + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "partialPosition", + "nparams": 0 + }, + { + "commandName": "stop", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["closed", "open", "partial"], + "qualifiedName": "core:OpenClosedPartialState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + } + ], + "widgetName": "PositionableGarageDoorWithPartialPosition", + "uiProfiles": ["OpenClose"], + "uiClass": "GarageDoor", + "qualifiedName": "io:DiscreteGarageOpenerWithPartialPositionIOComponent", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:OpenClosedPartialState", + "type": 3, + "value": "closed" + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + } + ], + "available": true, + "enabled": true, + "placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3", + "widget": "PositionableGarageDoorWithPartialPosition", + "type": 1, + "oid": "f1a2b3c4-d5e6-7890-abcd-ef1234567890", + "uiClass": "GarageDoor" } ], "zones": [], diff --git a/tests/components/overkiz/snapshots/test_cover.ambr b/tests/components/overkiz/snapshots/test_cover.ambr index dc35a2d803bc9..4683840c5f806 100644 --- a/tests/components/overkiz/snapshots/test_cover.ambr +++ b/tests/components/overkiz/snapshots/test_cover.ambr @@ -1081,6 +1081,59 @@ 'state': 'closed', }) # --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.garage_door-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.garage_door', + '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/16730050', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.garage_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'garage', + 'friendly_name': 'Garage Door', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.garage_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- # name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.garden_gate-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -1512,6 +1565,112 @@ 'state': 'closed', }) # --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.ogp_garage_door-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.ogp_garage_door', + '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/6632544', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.ogp_garage_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'garage', + 'friendly_name': 'OGP Garage Door', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.ogp_garage_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.partial_garage_door-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.partial_garage_door', + '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/7433515', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.partial_garage_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'garage', + 'friendly_name': 'Partial Garage Door', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.partial_garage_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- # name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.patio_shutter-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/overkiz/test_cover.py b/tests/components/overkiz/test_cover.py index 21bcc495ce213..3ec0e2b7ef37a 100644 --- a/tests/components/overkiz/test_cover.py +++ b/tests/components/overkiz/test_cover.py @@ -89,6 +89,21 @@ "io://1234-5678-5010/12931361", "cover.basement_roller_shutter", ) +DYNAMIC_GARAGE_DOOR = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "io://1234-1234-6233/16730050", + "cover.garage_door", +) +DYNAMIC_GARAGE_DOOR_OGP = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "ogp://1234-1234-6233/6632544", + "cover.ogp_garage_door", +) +PARTIAL_GARAGE_DOOR = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "io://1234-1234-6233/7433515", + "cover.partial_garage_door", +) SNAPSHOT_FIXTURES = [ AWNING, @@ -134,23 +149,41 @@ async def test_cover_entities_snapshot( (SHUTTER, SERVICE_OPEN_COVER, "open", CoverState.OPENING), (AWNING, SERVICE_OPEN_COVER, "deploy", CoverState.OPENING), (GARAGE, SERVICE_OPEN_COVER, "open", CoverState.OPENING), + (DYNAMIC_GARAGE_DOOR, SERVICE_OPEN_COVER, "open", CoverState.OPENING), + (DYNAMIC_GARAGE_DOOR_OGP, SERVICE_OPEN_COVER, "open", CoverState.OPENING), + (PARTIAL_GARAGE_DOOR, 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), + (DYNAMIC_GARAGE_DOOR, SERVICE_CLOSE_COVER, "close", CoverState.CLOSING), + (DYNAMIC_GARAGE_DOOR_OGP, SERVICE_CLOSE_COVER, "close", CoverState.CLOSING), + (PARTIAL_GARAGE_DOOR, 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), + (DYNAMIC_GARAGE_DOOR, SERVICE_STOP_COVER, "stop", CoverState.CLOSED), + (DYNAMIC_GARAGE_DOOR_OGP, SERVICE_STOP_COVER, "stop", CoverState.CLOSED), + (PARTIAL_GARAGE_DOOR, SERVICE_STOP_COVER, "stop", CoverState.CLOSED), ], ids=[ "open-roller-shutter", "open-awning", "open-garage-door", + "open-dynamic-garage-door", + "open-dynamic-garage-door-ogp", + "open-partial-garage-door", "close-roller-shutter", "close-awning", "close-garage-door", + "close-dynamic-garage-door", + "close-dynamic-garage-door-ogp", + "close-partial-garage-door", "stop-roller-shutter", "stop-awning", "stop-garage-door", + "stop-dynamic-garage-door", + "stop-dynamic-garage-door-ogp", + "stop-partial-garage-door", ], ) async def test_cover_service_actions(