mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix for assumed state in command_line (#5578)
* Bug fix for assumed state in command_line * command line * command line * command line * command line test
This commit is contained in:
parent
fb49c588e5
commit
a465a45588
@ -124,7 +124,7 @@ class CommandSwitch(SwitchDevice):
|
|||||||
@property
|
@property
|
||||||
def assumed_state(self):
|
def assumed_state(self):
|
||||||
"""Return true if we do optimistic updates."""
|
"""Return true if we do optimistic updates."""
|
||||||
return self._command_state is False
|
return self._command_state is None
|
||||||
|
|
||||||
def _query_state(self):
|
def _query_state(self):
|
||||||
"""Query for state."""
|
"""Query for state."""
|
||||||
|
@ -159,7 +159,7 @@ class TestCommandSwitch(unittest.TestCase):
|
|||||||
state = self.hass.states.get('switch.test')
|
state = self.hass.states.get('switch.test')
|
||||||
self.assertEqual(STATE_ON, state.state)
|
self.assertEqual(STATE_ON, state.state)
|
||||||
|
|
||||||
def test_assumed_state_should_be_true_if_command_state_is_false(self):
|
def test_assumed_state_should_be_true_if_command_state_is_none(self):
|
||||||
"""Test with state value."""
|
"""Test with state value."""
|
||||||
# args: hass, device_name, friendly_name, command_on, command_off,
|
# args: hass, device_name, friendly_name, command_on, command_off,
|
||||||
# command_state, value_template
|
# command_state, value_template
|
||||||
@ -169,7 +169,7 @@ class TestCommandSwitch(unittest.TestCase):
|
|||||||
"Test friendly name!",
|
"Test friendly name!",
|
||||||
"echo 'on command'",
|
"echo 'on command'",
|
||||||
"echo 'off command'",
|
"echo 'off command'",
|
||||||
False,
|
None,
|
||||||
None,
|
None,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user