ThrottledDevice: missing state notifiation
authorHelmut Grohne <helmut@subdivi.de>
Sun, 14 Jul 2013 06:42:34 +0000 (08:42 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Sun, 14 Jul 2013 06:42:34 +0000 (08:42 +0200)
When a throttled device is transitioning to off and we activate it,
activation may be a noop on the actual device thus not emitting any
state change. From a users point of view we are transitioning to on now,
so the state has changed.

onoff/common.py

index 9645cf3..3f63afd 100644 (file)
@@ -135,6 +135,7 @@ class ThrottledDevice(OnoffDevice):
             self._cancel_transition()
         self.desired_state = ST_ACTIVE
         self.device.activate()
+        self.changestate(self.device.state)
 
     def _do_stop(self):
         assert self.desired_state == 0