From a465a45588316c261e5a778a4e045236ce36b92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Fri, 27 Jan 2017 06:41:30 +0100 Subject: [PATCH] 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 --- homeassistant/components/switch/command_line.py | 2 +- tests/components/switch/test_command_line.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/switch/command_line.py b/homeassistant/components/switch/command_line.py index eca8f8b6023..e80348b0bee 100644 --- a/homeassistant/components/switch/command_line.py +++ b/homeassistant/components/switch/command_line.py @@ -124,7 +124,7 @@ class CommandSwitch(SwitchDevice): @property def assumed_state(self): """Return true if we do optimistic updates.""" - return self._command_state is False + return self._command_state is None def _query_state(self): """Query for state.""" diff --git a/tests/components/switch/test_command_line.py b/tests/components/switch/test_command_line.py index 008727df7f8..87eb12d8508 100644 --- a/tests/components/switch/test_command_line.py +++ b/tests/components/switch/test_command_line.py @@ -159,7 +159,7 @@ class TestCommandSwitch(unittest.TestCase): state = self.hass.states.get('switch.test') 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.""" # args: hass, device_name, friendly_name, command_on, command_off, # command_state, value_template @@ -169,7 +169,7 @@ class TestCommandSwitch(unittest.TestCase): "Test friendly name!", "echo 'on command'", "echo 'off command'", - False, + None, None, ]