mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Removing toggle function as it is confusing things more than it should
This commit is contained in:
parent
c1b62bf672
commit
bc8aa82a13
@ -92,7 +92,6 @@ class TransmissionSwitch(ToggleEntity):
|
|||||||
def __init__(self, transmission_client, name):
|
def __init__(self, transmission_client, name):
|
||||||
self._name = name
|
self._name = name
|
||||||
self.transmission_client = transmission_client
|
self.transmission_client = transmission_client
|
||||||
self.turtle_mode_active = False
|
|
||||||
self._state = STATE_OFF
|
self._state = STATE_OFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -117,27 +116,20 @@ class TransmissionSwitch(ToggleEntity):
|
|||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
""" Turn the device on. """
|
""" Turn the device on. """
|
||||||
|
|
||||||
if self._state == STATE_OFF:
|
_LOGGING.info("Turning on Turtle Mode")
|
||||||
_LOGGING.info("Turning on Turtle Mode")
|
self.transmission_client.set_session(
|
||||||
self.toggle_turtle_mode()
|
alt_speed_enabled=True)
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
""" Turn the device off. """
|
""" Turn the device off. """
|
||||||
|
|
||||||
if self._state == STATE_ON:
|
_LOGGING.info("Turning off Turtle Mode ")
|
||||||
_LOGGING.info("Turning off Turtle Mode ")
|
|
||||||
self.toggle_turtle_mode()
|
|
||||||
|
|
||||||
def toggle_turtle_mode(self):
|
|
||||||
""" Toggle turtle mode. """
|
|
||||||
|
|
||||||
self.transmission_client.set_session(
|
self.transmission_client.set_session(
|
||||||
alt_speed_enabled=not self.turtle_mode_active)
|
alt_speed_enabled=False)
|
||||||
self.update()
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Gets the latest data from Transmission and updates the state. """
|
""" Gets the latest data from Transmission and updates the state. """
|
||||||
|
|
||||||
self.turtle_mode_active = self.transmission_client.get_session(
|
active = self.transmission_client.get_session(
|
||||||
).alt_speed_enabled
|
).alt_speed_enabled
|
||||||
self._state = STATE_ON if self.turtle_mode_active else STATE_OFF
|
self._state = STATE_ON if active else STATE_OFF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user