Merge pull request #1551 from w1ll1am23/command_line_assumed

Added assumed state to command_line switch
This commit is contained in:
Paulus Schoutsen committed 2016-03-24 21:54:36 -07:00
commit 70ce179224
2 files changed
+25

No files matched your search

@@ -33,6 +33,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
add_devices_callback(devices)
# pylint: disable=too-many-instance-attributes
class CommandSwitch(SwitchDevice):
"""Representation a switch that can be toggled using shell commands."""
@@ -92,6 +93,11 @@ class CommandSwitch(SwitchDevice):
"""Return true if device is on."""
return self._state
@property
def assumed_state(self):
"""Return true if we do optimistic updates."""
return self._command_state is False
def _query_state(self):
"""Query for state."""
if not self._command_state: