diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index 0c74ea4eb31..b4b73d0e462 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -163,7 +163,7 @@ class CoverDevice(Entity): None is unknown, 0 is closed, 100 is fully open. """ - return None + pass @property def current_cover_tilt_position(self): @@ -171,7 +171,7 @@ class CoverDevice(Entity): None is unknown, 0 is closed, 100 is fully open. """ - return None + pass @property def state(self): @@ -186,9 +186,11 @@ class CoverDevice(Entity): @property def state_attributes(self): """Return the state attributes.""" - data = { - ATTR_CURRENT_POSITION: self.current_cover_position - } + data = {} + + current = self.current_cover_position + if current is not None: + data[ATTR_CURRENT_POSITION] = self.current_cover_position current_tilt = self.current_cover_tilt_position if current_tilt is not None: diff --git a/tests/components/cover/test_mqtt.py b/tests/components/cover/test_mqtt.py index a1b9f0b92fc..e2bc008f3d7 100644 --- a/tests/components/cover/test_mqtt.py +++ b/tests/components/cover/test_mqtt.py @@ -147,7 +147,7 @@ class TestCoverMQTT(unittest.TestCase): state_attributes_dict = self.hass.states.get( 'cover.test').attributes - self.assertTrue('current_position' in state_attributes_dict) + self.assertFalse('current_position' in state_attributes_dict) fire_mqtt_message(self.hass, 'state-topic', '0') self.hass.pool.block_till_done()