diff --git a/homeassistant/components/overkiz/cover.py b/homeassistant/components/overkiz/cover.py index 3030011c4d9b0b..659ab1b3525221 100644 --- a/homeassistant/components/overkiz/cover.py +++ b/homeassistant/components/overkiz/cover.py @@ -451,9 +451,14 @@ class OverkizCoverDescription(CoverEntityDescription): OverkizCoverDescription( key=UIClass.VENETIAN_BLIND, device_class=CoverDeviceClass.BLIND, + 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, + current_tilt_position_state=OverkizState.CORE_SLATE_ORIENTATION, + set_tilt_position_command=OverkizCommand.SET_ORIENTATION, open_tilt_command=OverkizCommand.TILT_UP, close_tilt_command=OverkizCommand.TILT_DOWN, stop_tilt_command=OverkizCommand.STOP, 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 acf036ee2ebe45..bd41e10d1155e7 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 @@ -8516,6 +8516,312 @@ "type": 1, "oid": "71df5650-2d35-4fae-bfff-787521598e7f", "uiClass": "Pergola" + }, + { + "label": "Bedroom Venetian Blind", + "uiClass": "VenetianBlind", + "deviceURL": "ogp://1234-1234-6233/16730100", + "shortcut": false, + "controllableName": "ogp:VenetianBlind", + "creationTime": 1773580989000, + "lastUpdateTime": 1773580989000, + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "goToAlias", + "nparams": 1 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "saveAlias", + "nparams": 1 + }, + { + "commandName": "setClosure", + "nparams": 1 + }, + { + "commandName": "setName", + "nparams": 1 + }, + { + "commandName": "setOrientation", + "nparams": 1 + }, + { + "commandName": "setTilt", + "nparams": 1 + }, + { + "commandName": "stop", + "nparams": 0 + } + ], + "states": [ + { + "type": "DataState", + "qualifiedName": "core:ActivePartitionState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:ClosureState" + }, + { + "eventBased": true, + "type": "DiscreteState", + "values": [ + "accessLimitation", + "internal", + "obstacleProtection", + "transportBusy", + "deviceNoAnswer", + "cancelled", + "deprecated", + "interrupted", + "thermalProtection", + "maintenanceRequired", + "alreadyUpToDate", + "notSupported", + "hardwareError", + "accessDenied", + "updateError", + "resourceAlreadyExist" + ], + "qualifiedName": "core:ErrorEventState" + }, + { + "type": "DataState", + "qualifiedName": "core:ErrorState" + }, + { + "type": "DataState", + "qualifiedName": "core:ErrorsState" + }, + { + "type": "DataState", + "qualifiedName": "core:FirmwareHashState" + }, + { + "type": "DataState", + "qualifiedName": "core:FirmwareRevisionState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "type": "DataState", + "qualifiedName": "core:NewFirmwareAvailableState" + }, + { + "type": "DiscreteState", + "values": ["closed", "open"], + "qualifiedName": "core:OpenClosedState" + }, + { + "type": "DataState", + "qualifiedName": "core:ReachedAliasesState" + }, + { + "type": "DataState", + "qualifiedName": "core:RemovableState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:SignalQualityState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:SlateOrientationState" + }, + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:StatusState" + }, + { + "type": "ContinuousState", + "qualifiedName": "core:TiltState" + } + ], + "dataProperties": [], + "widgetName": "DynamicVenetianBlind", + "uiProfiles": [ + "StatefulOrientableShutter", + "StatefulOrientablePlusCloseable", + "OrientablePlusCloseable", + "StatefulOpenClose", + "OpenClose", + "StatefulCloseable", + "Closeable" + ], + "uiClass": "VenetianBlind", + "qualifiedName": "ogp:VenetianBlind", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:NameState", + "type": 3, + "value": "Bedroom Venetian Blind" + }, + { + "name": "core:AvailabilityState", + "type": 3, + "value": "available" + }, + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:ErrorsState", + "type": 10, + "value": [] + }, + { + "name": "core:FirmwareRevisionState", + "type": 3, + "value": "5128194A13" + }, + { + "name": "core:FirmwareHashState", + "type": 3, + "value": "5128194A13" + }, + { + "name": "core:OpenClosedState", + "type": 3, + "value": "closed" + }, + { + "name": "core:ClosureState", + "type": 1, + "value": 100 + }, + { + "name": "core:TiltState", + "type": 1, + "value": 38 + }, + { + "name": "core:SlateOrientationState", + "type": 1, + "value": 38 + } + ], + "attributes": [ + { + "name": "core:SubType", + "type": 3, + "value": "outdoor" + }, + { + "name": "core:ManufacturerReference", + "type": 3, + "value": "venetianBlind" + }, + { + "name": "core:Technology", + "type": 3, + "value": "io2way" + }, + { + "name": "core:SupportedAliases", + "type": 10, + "value": [ + { + "id": "6", + "type": "favorite1", + "features": ["tiltPosition", "openClosePosition"] + }, + { + "id": "4", + "type": "favorite1", + "features": ["tiltPosition", "openClosePosition"] + }, + { + "id": "1", + "type": "favorite1", + "features": ["openClosePosition"] + }, + { + "id": "2", + "type": "favorite1", + "features": ["tiltPosition"] + }, + { + "id": "3", + "type": "favorite1", + "features": ["openClosePosition", "tiltPosition"] + }, + { + "id": "5", + "type": "favorite1", + "features": ["openClosePosition", "tiltPosition"] + } + ] + }, + { + "name": "ogp:Features", + "type": 10, + "value": [ + { + "name": "firmware", + "commandLess": true + }, + { + "name": "openClosePosition" + }, + { + "name": "tiltPosition" + }, + { + "name": "openClose" + }, + { + "name": "stop" + }, + { + "name": "identification" + }, + { + "name": "diagnosis" + }, + { + "name": "alias" + } + ] + }, + { + "name": "core:Manufacturer", + "type": 3, + "value": "Somfy" + } + ], + "available": true, + "enabled": true, + "placeOID": "972455eb-4f91-4095-bf42-55c234bb6238", + "oid": "aaaaaaaa-bbbb-cccc-dddd-ffffffffffff", + "widget": "DynamicVenetianBlind", + "type": 1 } ], "zones": [], diff --git a/tests/components/overkiz/fixtures/setup/local_somfy_tahoma_v2_europe.json b/tests/components/overkiz/fixtures/setup/local_somfy_tahoma_v2_europe.json index 4b8666dde8c53e..1a1fe2c65a8c96 100644 --- a/tests/components/overkiz/fixtures/setup/local_somfy_tahoma_v2_europe.json +++ b/tests/components/overkiz/fixtures/setup/local_somfy_tahoma_v2_europe.json @@ -1904,6 +1904,476 @@ "uiClass": "GarageDoor", "type": "ACTUATOR" } + }, + { + "attributes": [ + { + "name": "zigbee:Role", + "type": 3, + "value": "endDevice" + }, + { + "name": "core:ManufacturerId", + "type": 3, + "value": 4640 + }, + { + "name": "zigbee:NotificationEnable", + "type": 6, + "value": true + }, + { + "name": "zigbee:InputClusters", + "type": 10, + "value": ["identify", "scenes", "windowCovering"] + }, + { + "name": "core:OrientationPhysicalUpperBound", + "type": 1, + "value": 90 + }, + { + "name": "core:Compatibilities", + "type": 10, + "value": ["homekit"] + }, + { + "name": "zigbee:SomfyEndProduct", + "type": 3, + "value": "2DInteriorBlind" + }, + { + "name": "core:MacAddress", + "type": 3, + "value": "dXsY/v8Gwkw=" + }, + { + "name": "core:OrientationPhysicalLowerBound", + "type": 1, + "value": -90 + } + ], + "available": true, + "definition": { + "uiClass": "VenetianBlind", + "commands": [ + { + "commandName": "my", + "nparams": 0 + }, + { + "commandName": "setPosition", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "close", + "nparams": 0 + }, + { + "commandName": "removeLockLevel", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "setPositionByStep", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "setOrientation", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "advancedRefresh", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "resetFactoryDefaultsAndConfiguration", + "nparams": 0 + }, + { + "commandName": "storeCurrentPositionToMy", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "leaveNetworkOnly", + "nparams": 0 + }, + { + "commandName": "ping", + "nparams": 0 + }, + { + "commandName": "setTiltingRangeConfiguration", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "commandName": "addLockLevel", + "nparams": 1, + "paramsSig": "p1,*p2" + }, + { + "commandName": "unbind", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "resetLockLevels", + "nparams": 0 + }, + { + "commandName": "setPositionNoLimit", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "stop", + "nparams": 0 + }, + { + "commandName": "reverseDirection", + "nparams": 0 + }, + { + "commandName": "bind", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "setPositionLimitation", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "setClosureAndOrientation", + "nparams": 2, + "paramsSig": "p1,p2" + }, + { + "commandName": "setName", + "nparams": 1, + "paramsSig": "p1" + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "commandName": "setClosure", + "nparams": 1, + "paramsSig": "p1" + } + ], + "type": "ACTUATOR", + "widgetName": "PositionableVenetianBlind", + "states": [ + { + "name": "core:OperationalStatusState" + }, + { + "name": "core:SlateOrientationState" + }, + { + "name": "zigbee:DirectionState" + }, + { + "name": "core:TargetClosureState" + }, + { + "name": "zigbee:EncoderLiftState" + }, + { + "name": "core:OrientationOperationalStatusState" + }, + { + "name": "core:TargetOrientationState" + }, + { + "name": "zigbee:EncoderTiltState" + }, + { + "name": "core:OpenLimitTiltState" + }, + { + "name": "core:ClosedLimitTiltState" + }, + { + "name": "zigbee:MotorRunModeState" + }, + { + "name": "core:ClosureOperationalStatusState" + }, + { + "name": "core:OpenLimitLiftState" + }, + { + "name": "zigbee:MotorRunningModeState" + }, + { + "name": "core:ErrorState" + }, + { + "name": "core:ConfigStatusState" + }, + { + "name": "zigbee:MotorLEDFeedbackState" + }, + { + "name": "zigbee:ControlTiltState" + }, + { + "name": "zigbee:ControlLiftState" + }, + { + "name": "zigbee:ReversalLiftState" + }, + { + "name": "zigbee:NetworkOnlineState" + }, + { + "name": "core:ClosureState" + }, + { + "name": "core:ClosedLimitLiftState" + }, + { + "name": "core:StatusState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "zigbee:LinkQualityIndicatorState" + }, + { + "name": "zigbee:ZigbeeUpdateDownloadProgressState" + }, + { + "name": "zigbee:ZigbeeUpdateState" + }, + { + "name": "core:FirmwareRevisionState" + }, + { + "name": "core:CommandLockLevelsState" + }, + { + "name": "core:ProductSoftwareVersionState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:ProductHardwareVersionState" + }, + { + "name": "zigbee:PowerSourceState" + }, + { + "name": "core:ManufacturerNameState" + }, + { + "name": "core:ProductSoftwareBuildIdState" + }, + { + "name": "core:MotorBoardSoftwareVersionState" + }, + { + "name": "core:MotorBoardSoftwareBuildIdState" + }, + { + "name": "core:MotorBoardHardwareVersionState" + }, + { + "name": "core:ProductModelNameState" + } + ], + "attributes": [ + { + "name": "zigbee:Role" + }, + { + "name": "core:ManufacturerId" + }, + { + "name": "zigbee:NotificationEnable" + }, + { + "name": "zigbee:InputClusters" + }, + { + "name": "core:OrientationPhysicalUpperBound" + }, + { + "name": "core:Compatibilities" + }, + { + "name": "zigbee:SomfyEndProduct" + }, + { + "name": "core:MacAddress" + }, + { + "name": "core:OrientationPhysicalLowerBound" + }, + { + "name": "zigbee:OutputClusters" + } + ] + }, + "controllableName": "zigbee:SomfyVenetianBlindComponent", + "deviceURL": "zigbee://1234-5678-3293/16730099", + "states": [ + { + "name": "core:CommandLockLevelsState", + "type": 11, + "value": [] + }, + { + "name": "core:ClosureOperationalStatusState", + "type": 3, + "value": "not moving" + }, + { + "name": "core:OrientationOperationalStatusState", + "type": 3, + "value": "not moving" + }, + { + "name": "core:OperationalStatusState", + "type": 3, + "value": "not moving" + }, + { + "name": "core:DiscreteRSSILevelState", + "type": 3, + "value": "verylow" + }, + { + "name": "zigbee:LinkQualityIndicatorState", + "type": 1, + "value": 54 + }, + { + "name": "core:RSSILevelState", + "type": 1, + "value": -86 + }, + { + "name": "core:StatusState", + "type": 3, + "value": "available" + }, + { + "name": "core:SlateOrientationState", + "type": 1, + "value": 0 + }, + { + "name": "core:ClosureState", + "type": 1, + "value": 100 + }, + { + "name": "zigbee:MotorRunningModeState", + "type": 3, + "value": "motor is running normally" + }, + { + "name": "zigbee:MotorLEDFeedbackState", + "type": 3, + "value": "LEDs are off" + }, + { + "name": "zigbee:DirectionState", + "type": 3, + "value": "counterClockwise" + }, + { + "name": "zigbee:MotorRunModeState", + "type": 3, + "value": "run in normal mode" + }, + { + "name": "zigbee:EncoderTiltState", + "type": 3, + "value": "encoder controlled" + }, + { + "name": "core:ConfigStatusState", + "type": 3, + "value": "operational" + }, + { + "name": "zigbee:ControlLiftState", + "type": 3, + "value": "lift control is closed loop" + }, + { + "name": "zigbee:ReversalLiftState", + "type": 3, + "value": "not reversal lift commands" + }, + { + "name": "zigbee:EncoderLiftState", + "type": 3, + "value": "encoder controlled" + }, + { + "name": "zigbee:NetworkOnlineState", + "type": 3, + "value": "online" + }, + { + "name": "zigbee:ControlTiltState", + "type": 3, + "value": "tilt control is closed loop" + }, + { + "name": "core:NameState", + "type": 3, + "value": "Living Room Venetian Blind" + }, + { + "name": "core:TargetOrientationState", + "type": 1, + "value": 0 + }, + { + "name": "core:TargetClosureState", + "type": 1, + "value": 100 + }, + { + "name": "core:ErrorState", + "type": 3, + "value": "no error" + } + ], + "label": "Living Room Venetian Blind", + "enabled": true, + "subsystemId": 0, + "synced": true, + "type": 1 } ] } diff --git a/tests/components/overkiz/snapshots/test_button.ambr b/tests/components/overkiz/snapshots/test_button.ambr index 6f6c5c886d3204..07d779f0af84a4 100644 --- a/tests/components/overkiz/snapshots/test_button.ambr +++ b/tests/components/overkiz/snapshots/test_button.ambr @@ -1845,6 +1845,108 @@ 'state': 'unknown', }) # --- +# name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.bedroom_venetian_blind_my_position-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': 'button', + 'entity_category': None, + 'entity_id': 'button.bedroom_venetian_blind_my_position', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'My position', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:star', + 'original_name': 'My position', + 'platform': 'overkiz', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'ogp://1234-1234-6233/16730100-goToAlias', + 'unit_of_measurement': None, + }) +# --- +# name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.bedroom_venetian_blind_my_position-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Bedroom Venetian Blind My position', + 'icon': 'mdi:star', + }), + 'context': , + 'entity_id': 'button.bedroom_venetian_blind_my_position', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.bedroom_venetian_blind_start_identify-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': 'button', + 'entity_category': , + 'entity_id': 'button.bedroom_venetian_blind_start_identify', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Start identify', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:human-greeting-variant', + 'original_name': 'Start identify', + 'platform': 'overkiz', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'ogp://1234-1234-6233/16730100-identify', + 'unit_of_measurement': None, + }) +# --- +# name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.bedroom_venetian_blind_start_identify-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Bedroom Venetian Blind Start identify', + 'icon': 'mdi:human-greeting-variant', + }), + 'context': , + 'entity_id': 'button.bedroom_venetian_blind_start_identify', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.bedroom_window_identify-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/overkiz/snapshots/test_cover.ambr b/tests/components/overkiz/snapshots/test_cover.ambr index b131c9aad747f6..44ddb454041a41 100644 --- a/tests/components/overkiz/snapshots/test_cover.ambr +++ b/tests/components/overkiz/snapshots/test_cover.ambr @@ -1188,6 +1188,61 @@ 'state': 'closed', }) # --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.bedroom_venetian_blind-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.bedroom_venetian_blind', + '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/16730100', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.bedroom_venetian_blind-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_position': 0, + 'current_tilt_position': 62, + 'device_class': 'blind', + 'friendly_name': 'Bedroom Venetian Blind', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.bedroom_venetian_blind', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- # name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.bedroom_window-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -3999,6 +4054,61 @@ 'state': 'unknown', }) # --- +# name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.living_room_venetian_blind-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.living_room_venetian_blind', + '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': 'zigbee://1234-5678-3293/16730099', + 'unit_of_measurement': None, + }) +# --- +# name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.living_room_venetian_blind-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_position': 0, + 'current_tilt_position': 100, + 'device_class': 'blind', + 'friendly_name': 'Living Room Venetian Blind', + 'is_closed': True, + 'supported_features': , + }), + 'context': , + 'entity_id': 'cover.living_room_venetian_blind', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- # name: test_cover_entities_snapshot[local_somfy_tahoma_v2_europe.json][cover.office_screen-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/overkiz/test_cover.py b/tests/components/overkiz/test_cover.py index 092505a84cb60f..fefcafc21a7297 100644 --- a/tests/components/overkiz/test_cover.py +++ b/tests/components/overkiz/test_cover.py @@ -169,6 +169,16 @@ "io://1234-1234-6233/11447718", "cover.pergola_awning", ) +DYNAMIC_VENETIAN_BLIND = FixtureDevice( + "setup/cloud_somfy_tahoma_v2_europe.json", + "ogp://1234-1234-6233/16730100", + "cover.bedroom_venetian_blind", +) +POSITIONABLE_VENETIAN_BLIND = FixtureDevice( + "setup/local_somfy_tahoma_v2_europe.json", + "zigbee://1234-5678-3293/16730099", + "cover.living_room_venetian_blind", +) SNAPSHOT_FIXTURES = [ AWNING, @@ -241,6 +251,13 @@ async def test_cover_entities_snapshot( (TILT_ONLY_VENETIAN_BLIND, SERVICE_OPEN_COVER, "open", [0], CoverState.OPENING), (UP_DOWN_VENETIAN_BLIND, SERVICE_OPEN_COVER, "open", [0], CoverState.OPENING), (UP_DOWN_SHEER_SCREEN, SERVICE_OPEN_COVER, "open", [0], CoverState.OPENING), + ( + DYNAMIC_VENETIAN_BLIND, + SERVICE_OPEN_COVER, + "open", + None, + CoverState.OPENING, + ), (SHUTTER, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING), (AWNING, SERVICE_CLOSE_COVER, "undeploy", None, CoverState.CLOSING), (GARAGE, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING), @@ -285,6 +302,13 @@ async def test_cover_entities_snapshot( ), (UP_DOWN_VENETIAN_BLIND, SERVICE_CLOSE_COVER, "close", [0], CoverState.CLOSING), (UP_DOWN_SHEER_SCREEN, SERVICE_CLOSE_COVER, "close", [0], CoverState.CLOSING), + ( + DYNAMIC_VENETIAN_BLIND, + SERVICE_CLOSE_COVER, + "close", + None, + CoverState.CLOSING, + ), (SHUTTER, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), (AWNING, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), (GARAGE, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED), @@ -310,6 +334,13 @@ async def test_cover_entities_snapshot( STATE_UNKNOWN, ), (TILT_ONLY_VENETIAN_BLIND, SERVICE_STOP_COVER, "stop", [0], STATE_UNKNOWN), + ( + DYNAMIC_VENETIAN_BLIND, + SERVICE_STOP_COVER, + "stop", + None, + CoverState.CLOSED, + ), ( TILT_ONLY_VENETIAN_BLIND, SERVICE_OPEN_COVER_TILT, @@ -395,6 +426,7 @@ async def test_cover_entities_snapshot( "open-tilt-only-venetian-blind", "open-venetian-blind-rts", "open-sheer-screen-rts", + "open-dynamic-venetian-blind", "close-roller-shutter", "close-awning", "close-garage-door", @@ -413,6 +445,7 @@ async def test_cover_entities_snapshot( "close-tilt-only-venetian-blind", "close-venetian-blind-rts", "close-sheer-screen-rts", + "close-dynamic-venetian-blind", "stop-roller-shutter", "stop-awning", "stop-garage-door", @@ -426,6 +459,7 @@ async def test_cover_entities_snapshot( "stop-pergola-horizontal-awning", "stop-up-down-bioclimatic-pergola", "stop-tilt-only-venetian-blind", + "stop-dynamic-venetian-blind", "open-tilt-tilt-only-venetian-blind", "close-tilt-tilt-only-venetian-blind", "stop-tilt-tilt-only-venetian-blind", @@ -496,6 +530,13 @@ async def test_cover_service_actions( [80], 80, ), + ( + DYNAMIC_VENETIAN_BLIND, + DYNAMIC_VENETIAN_BLIND.entity_id, + "setClosure", + [75], + 25, + ), ], ids=[ "roller-shutter", @@ -503,6 +544,7 @@ async def test_cover_service_actions( "low-speed", "dynamic-pergola", "pergola-horizontal-awning", + "dynamic-venetian-blind", ], ) async def test_cover_set_position( @@ -533,6 +575,43 @@ async def test_cover_set_position( ) +async def test_is_closed_falls_back_to_position( + hass: HomeAssistant, + setup_overkiz_integration: SetupOverkizIntegration, + mock_client: MockOverkizClient, + freezer: FrozenDateTimeFactory, +) -> None: + """Test is_closed derives from position when OpenClosedState is absent.""" + await setup_overkiz_integration(fixture=POSITIONABLE_VENETIAN_BLIND.fixture) + + state = hass.states.get(POSITIONABLE_VENETIAN_BLIND.entity_id) + assert state.state == CoverState.CLOSED + assert state.attributes[ATTR_CURRENT_POSITION] == 0 + + await async_deliver_events( + hass, + freezer, + mock_client, + [ + build_event( + EventName.DEVICE_STATE_CHANGED.value, + device_url=POSITIONABLE_VENETIAN_BLIND.device_url, + device_states=[ + { + "name": OverkizState.CORE_CLOSURE.value, + "type": 1, + "value": 50, + }, + ], + ) + ], + ) + + state = hass.states.get(POSITIONABLE_VENETIAN_BLIND.entity_id) + assert state.state == CoverState.OPEN + assert state.attributes[ATTR_CURRENT_POSITION] == 50 + + async def test_cover_tilt_services( hass: HomeAssistant, setup_overkiz_integration: SetupOverkizIntegration,