mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Don't return cover position when not supported (#22484)
This commit is contained in:
parent
78e162c1d3
commit
e26a5abb2b
@ -135,6 +135,8 @@ class SmartThingsCover(SmartThingsEntity, CoverDevice):
|
|||||||
@property
|
@property
|
||||||
def current_cover_position(self):
|
def current_cover_position(self):
|
||||||
"""Return current position of cover."""
|
"""Return current position of cover."""
|
||||||
|
if not self._supported_features & SUPPORT_SET_POSITION:
|
||||||
|
return None
|
||||||
return self._device.status.level
|
return self._device.status.level
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -142,7 +142,10 @@ async def test_set_cover_position_unsupported(hass, device_factory):
|
|||||||
COVER_DOMAIN, SERVICE_SET_COVER_POSITION,
|
COVER_DOMAIN, SERVICE_SET_COVER_POSITION,
|
||||||
{ATTR_POSITION: 50}, blocking=True)
|
{ATTR_POSITION: 50}, blocking=True)
|
||||||
|
|
||||||
# Ensure API was notcalled
|
state = hass.states.get('cover.shade')
|
||||||
|
assert ATTR_CURRENT_POSITION not in state.attributes
|
||||||
|
|
||||||
|
# Ensure API was not called
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
assert device._api.post_device_command.call_count == 0 # type: ignore
|
assert device._api.post_device_command.call_count == 0 # type: ignore
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user