Added assumed state to command_line switch
This commit is contained in:
1 parent
fa15d86c2b
commit
a64726e321
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:
|
||||
|
||||
Reference in new issue
Block a user