From c1b62bf672002ad912d36a6e25d8655d95343b54 Mon Sep 17 00:00:00 2001 From: Finbarr Brady <finbarr.brady@gmail.com> Date: Sun, 31 May 2015 11:51:45 +0000 Subject: [PATCH] Only toggle if in the correct state. --- homeassistant/components/switch/transmission.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/switch/transmission.py b/homeassistant/components/switch/transmission.py index 43d3adf1eee..1431ae34c8b 100644 --- a/homeassistant/components/switch/transmission.py +++ b/homeassistant/components/switch/transmission.py @@ -117,14 +117,16 @@ class TransmissionSwitch(ToggleEntity): def turn_on(self, **kwargs): """ Turn the device on. """ - _LOGGING.info("Turning on Turtle Mode") - self.toggle_turtle_mode() + if self._state == STATE_OFF: + _LOGGING.info("Turning on Turtle Mode") + self.toggle_turtle_mode() def turn_off(self, **kwargs): """ Turn the device off. """ - _LOGGING.info("Turning off Turtle Mode ") - self.toggle_turtle_mode() + if self._state == STATE_ON: + _LOGGING.info("Turning off Turtle Mode ") + self.toggle_turtle_mode() def toggle_turtle_mode(self): """ Toggle turtle mode. """ -- GitLab