def tellstick_resend(tdev): """Resend last command to a telldus device. Not protected by lock as it is in stop method""" methods = telldus.tdLastSentCommand(tdev, self.ALL_METHODS) if methods & self.TELLSTICK_TURNON: telldus.tdTurnOn(tdev) time.sleep(self._lock_delay) elif methods & self.TELLSTICK_TURNOFF: telldus.tdTurnOff(tdev) time.sleep(self._lock_delay) else: logger.warning('[%s] - Unknown resend method %s', self.__class__.__name__, methods)
def tellstick_turnoff(tdev): """Turn off a telldus device""" self.tellstick_acquire() try: methods = telldus.tdMethods(tdev, self.ALL_METHODS) if methods & self.TELLSTICK_TURNOFF: telldus.tdTurnOff(tdev) time.sleep(self._lock_delay) except Exception: logger.exception('[%s] - Exception when tellstick_turnoff', self.__class__.__name__) finally: self.tellstick_release()
def turnOff(): print "turning off" telldus.tdTurnOff(1)
if deviceid: name = telldus.tdGetName(deviceid) print "%s - %s\n" % (deviceid, name) methods = telldus.tdMethods(deviceid, allMethods) if methods & telldus.TELLSTICK_TURNON: print " * TurnOn\n" telldus.tdTurnOn(deviceid) time.sleep(1) if methods & telldus.TELLSTICK_TURNOFF: print " * TurnOff\n" telldus.tdTurnOff(deviceid) time.sleep(1) if methods & telldus.TELLSTICK_BELL: print " * Bell\n" telldus.tdBell(deviceid) time.sleep(1) if methods & telldus.TELLSTICK_TOGGLE: print " * Toggle\n" if methods & telldus.TELLSTICK_DIM: print " * Dim\n" telldus.tdDim(deviceid, 128) time.sleep(1)