mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Cover (#2957)
* current_position was set, it should be optional * Update mqtt test to match
This commit is contained in:
parent
4795122463
commit
e5abf6074c
@ -163,7 +163,7 @@ class CoverDevice(Entity):
|
|||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
return None
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_tilt_position(self):
|
def current_cover_tilt_position(self):
|
||||||
@ -171,7 +171,7 @@ class CoverDevice(Entity):
|
|||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
return None
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
@ -186,9 +186,11 @@ class CoverDevice(Entity):
|
|||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
data = {
|
data = {}
|
||||||
ATTR_CURRENT_POSITION: self.current_cover_position
|
|
||||||
}
|
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
|
current_tilt = self.current_cover_tilt_position
|
||||||
if current_tilt is not None:
|
if current_tilt is not None:
|
||||||
|
@ -147,7 +147,7 @@ class TestCoverMQTT(unittest.TestCase):
|
|||||||
|
|
||||||
state_attributes_dict = self.hass.states.get(
|
state_attributes_dict = self.hass.states.get(
|
||||||
'cover.test').attributes
|
'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')
|
fire_mqtt_message(self.hass, 'state-topic', '0')
|
||||||
self.hass.pool.block_till_done()
|
self.hass.pool.block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user