mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Fix windowShadeLevel capability in SmartThings (#140552)
This commit is contained in:
parent
b1285fcc4e
commit
058aed96d2
@ -125,6 +125,10 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
||||
self._attr_current_cover_position = self.get_attribute_value(
|
||||
Capability.SWITCH_LEVEL, Attribute.LEVEL
|
||||
)
|
||||
elif self.supports_capability(Capability.WINDOW_SHADE_LEVEL):
|
||||
self._attr_current_cover_position = self.get_attribute_value(
|
||||
Capability.WINDOW_SHADE_LEVEL, Attribute.SHADE_LEVEL
|
||||
)
|
||||
|
||||
self._attr_extra_state_attributes = {}
|
||||
if self.supports_capability(Capability.BATTERY):
|
||||
|
@ -134,6 +134,7 @@ def mock_smartthings() -> Generator[AsyncMock]:
|
||||
"im_speaker_ai_0001",
|
||||
"abl_light_b_001",
|
||||
"tplink_p110",
|
||||
"ikea_kadrilj",
|
||||
]
|
||||
)
|
||||
def device_fixture(
|
||||
|
@ -0,0 +1,68 @@
|
||||
{
|
||||
"components": {
|
||||
"main": {
|
||||
"windowShadeLevel": {
|
||||
"shadeLevel": {
|
||||
"value": 32,
|
||||
"unit": "%",
|
||||
"timestamp": "2025-03-13T10:40:25.613Z"
|
||||
}
|
||||
},
|
||||
"refresh": {},
|
||||
"windowShadePreset": {},
|
||||
"battery": {
|
||||
"quantity": {
|
||||
"value": null
|
||||
},
|
||||
"battery": {
|
||||
"value": 37,
|
||||
"unit": "%",
|
||||
"timestamp": "2025-03-13T07:09:05.149Z"
|
||||
},
|
||||
"type": {
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"firmwareUpdate": {
|
||||
"lastUpdateStatusReason": {
|
||||
"value": null
|
||||
},
|
||||
"availableVersion": {
|
||||
"value": "22007631",
|
||||
"timestamp": "2025-03-12T20:35:04.576Z"
|
||||
},
|
||||
"lastUpdateStatus": {
|
||||
"value": null
|
||||
},
|
||||
"supportedCommands": {
|
||||
"value": null
|
||||
},
|
||||
"state": {
|
||||
"value": "updateRequested",
|
||||
"timestamp": "2025-03-12T20:35:03.879Z"
|
||||
},
|
||||
"updateAvailable": {
|
||||
"value": false,
|
||||
"timestamp": "2025-03-12T20:35:04.577Z"
|
||||
},
|
||||
"currentVersion": {
|
||||
"value": "22007631",
|
||||
"timestamp": "2025-03-12T20:35:04.508Z"
|
||||
},
|
||||
"lastUpdateTime": {
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"windowShade": {
|
||||
"supportedWindowShadeCommands": {
|
||||
"value": ["open", "close", "pause"],
|
||||
"timestamp": "2025-03-13T10:33:48.402Z"
|
||||
},
|
||||
"windowShade": {
|
||||
"value": "partially open",
|
||||
"timestamp": "2025-03-13T10:55:58.205Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"deviceId": "71afed1c-006d-4e48-b16e-e7f88f9fd638",
|
||||
"name": "window-treatment-battery",
|
||||
"label": "Kitchen IKEA KADRILJ Window blind",
|
||||
"manufacturerName": "SmartThingsCommunity",
|
||||
"presentationId": "fa41d7d3-4c03-327f-b0ce-2edc829f0e34",
|
||||
"deviceManufacturerCode": "IKEA of Sweden",
|
||||
"locationId": "5b5f96b5-0286-4f4a-86ef-d5d5c1a78cb8",
|
||||
"ownerId": "f43fd9e5-2ecd-4aae-aeac-73a8e5cb04da",
|
||||
"roomId": "89f675a1-1f16-451c-8ab1-a7fdacc5852d",
|
||||
"components": [
|
||||
{
|
||||
"id": "main",
|
||||
"label": "main",
|
||||
"capabilities": [
|
||||
{
|
||||
"id": "windowShade",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"id": "windowShadePreset",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"id": "windowShadeLevel",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"id": "battery",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"id": "firmwareUpdate",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"id": "refresh",
|
||||
"version": 1
|
||||
}
|
||||
],
|
||||
"categories": [
|
||||
{
|
||||
"name": "Blind",
|
||||
"categoryType": "manufacturer"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"createTime": "2023-04-26T18:19:06.792Z",
|
||||
"parentDeviceId": "3ffe04c4-a12c-41f5-b83d-c1b28eca2b5f",
|
||||
"profile": {
|
||||
"id": "6d9804bc-9e56-3823-95be-4b315669c481"
|
||||
},
|
||||
"zigbee": {
|
||||
"eui": "000D6FFFFE2AD0E7",
|
||||
"networkId": "3009",
|
||||
"driverId": "46b8bada-1a55-4f84-8915-47ce2cad3621",
|
||||
"executingLocally": true,
|
||||
"hubId": "3ffe04c4-a12c-41f5-b83d-c1b28eca2b5f",
|
||||
"provisioningState": "NONFUNCTIONAL"
|
||||
},
|
||||
"type": "ZIGBEE",
|
||||
"restrictionTier": 0,
|
||||
"allowed": null,
|
||||
"indoorMap": {
|
||||
"coordinates": [10.0, 36.0, 98.0],
|
||||
"rotation": [270.0, 0.0, 0.0],
|
||||
"visible": true,
|
||||
"data": null
|
||||
},
|
||||
"executionContext": "LOCAL",
|
||||
"relationships": []
|
||||
}
|
||||
],
|
||||
"_links": {}
|
||||
}
|
@ -49,3 +49,54 @@
|
||||
'state': 'open',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[ikea_kadrilj][cover.kitchen_ikea_kadrilj_window_blind-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'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_ikea_kadrilj_window_blind',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <CoverDeviceClass.SHADE: 'shade'>,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'smartthings',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <CoverEntityFeature: 7>,
|
||||
'translation_key': None,
|
||||
'unique_id': '71afed1c-006d-4e48-b16e-e7f88f9fd638',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[ikea_kadrilj][cover.kitchen_ikea_kadrilj_window_blind-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'battery_level': 37,
|
||||
'current_position': 32,
|
||||
'device_class': 'shade',
|
||||
'friendly_name': 'Kitchen IKEA KADRILJ Window blind',
|
||||
'supported_features': <CoverEntityFeature: 7>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'cover.kitchen_ikea_kadrilj_window_blind',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'open',
|
||||
})
|
||||
# ---
|
||||
|
@ -992,6 +992,39 @@
|
||||
'via_device_id': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_devices[ikea_kadrilj]
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'config_entries_subentries': <ANY>,
|
||||
'configuration_url': 'https://account.smartthings.com',
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'smartthings',
|
||||
'71afed1c-006d-4e48-b16e-e7f88f9fd638',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': None,
|
||||
'model': None,
|
||||
'model_id': None,
|
||||
'name': 'Kitchen IKEA KADRILJ Window blind',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': None,
|
||||
'via_device_id': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_devices[im_speaker_ai_0001]
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
|
@ -5906,6 +5906,55 @@
|
||||
'state': '19.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[ikea_kadrilj][sensor.kitchen_ikea_kadrilj_window_blind_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.kitchen_ikea_kadrilj_window_blind_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Battery',
|
||||
'platform': 'smartthings',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '71afed1c-006d-4e48-b16e-e7f88f9fd638.battery',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[ikea_kadrilj][sensor.kitchen_ikea_kadrilj_window_blind_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Kitchen IKEA KADRILJ Window blind Battery',
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.kitchen_ikea_kadrilj_window_blind_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '37',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[im_speaker_ai_0001][sensor.galaxy_home_mini_media_input_source-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
Loading…
x
Reference in New Issue
Block a user