diff --git a/homeassistant/components/smartthings/cover.py b/homeassistant/components/smartthings/cover.py index 131da75f4fe..53602c3643c 100644 --- a/homeassistant/components/smartthings/cover.py +++ b/homeassistant/components/smartthings/cover.py @@ -135,6 +135,8 @@ class SmartThingsCover(SmartThingsEntity, CoverDevice): @property def current_cover_position(self): """Return current position of cover.""" + if not self._supported_features & SUPPORT_SET_POSITION: + return None return self._device.status.level @property diff --git a/tests/components/smartthings/test_cover.py b/tests/components/smartthings/test_cover.py index 7e41237e3e7..fb90882eae8 100644 --- a/tests/components/smartthings/test_cover.py +++ b/tests/components/smartthings/test_cover.py @@ -142,7 +142,10 @@ async def test_set_cover_position_unsupported(hass, device_factory): COVER_DOMAIN, SERVICE_SET_COVER_POSITION, {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 assert device._api.post_device_command.call_count == 0 # type: ignore