mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Fix HomeKit cover creation with tilt position, open/close, no set position (#54727)
This commit is contained in:
parent
d7c1e7c7dc
commit
87496ae75c
@ -134,10 +134,15 @@ def get_accessory(hass, driver, state, aid, config): # noqa: C901
|
|||||||
and features & cover.SUPPORT_SET_POSITION
|
and features & cover.SUPPORT_SET_POSITION
|
||||||
):
|
):
|
||||||
a_type = "Window"
|
a_type = "Window"
|
||||||
elif features & (cover.SUPPORT_SET_POSITION | cover.SUPPORT_SET_TILT_POSITION):
|
elif features & cover.SUPPORT_SET_POSITION:
|
||||||
a_type = "WindowCovering"
|
a_type = "WindowCovering"
|
||||||
elif features & (cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE):
|
elif features & (cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE):
|
||||||
a_type = "WindowCoveringBasic"
|
a_type = "WindowCoveringBasic"
|
||||||
|
elif features & cover.SUPPORT_SET_TILT_POSITION:
|
||||||
|
# WindowCovering and WindowCoveringBasic both support tilt
|
||||||
|
# only WindowCovering can handle the covers that are missing
|
||||||
|
# SUPPORT_SET_POSITION, SUPPORT_OPEN, and SUPPORT_CLOSE
|
||||||
|
a_type = "WindowCovering"
|
||||||
|
|
||||||
elif state.domain == "fan":
|
elif state.domain == "fan":
|
||||||
a_type = "Fan"
|
a_type = "Fan"
|
||||||
|
@ -149,6 +149,18 @@ def test_types(type_name, entity_id, state, attrs, config):
|
|||||||
"open",
|
"open",
|
||||||
{ATTR_SUPPORTED_FEATURES: (cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE)},
|
{ATTR_SUPPORTED_FEATURES: (cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE)},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"WindowCoveringBasic",
|
||||||
|
"cover.open_window",
|
||||||
|
"open",
|
||||||
|
{
|
||||||
|
ATTR_SUPPORTED_FEATURES: (
|
||||||
|
cover.SUPPORT_OPEN
|
||||||
|
| cover.SUPPORT_CLOSE
|
||||||
|
| cover.SUPPORT_SET_TILT_POSITION
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_type_covers(type_name, entity_id, state, attrs):
|
def test_type_covers(type_name, entity_id, state, attrs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user