コード例 #1
0
ファイル: bus.py プロジェクト: bibi21000/janitoo_tellstick
 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)
コード例 #2
0
ファイル: bus.py プロジェクト: bibi21000/janitoo_tellstick
 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()
コード例 #3
0
 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)
コード例 #4
0
 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()
コード例 #5
0
ファイル: callback.py プロジェクト: Balex93/telldus
def turnOff():
	print "turning off"
	telldus.tdTurnOff(1)
コード例 #6
0
	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)
コード例 #7
0
ファイル: callback.py プロジェクト: yuanqingmei/telldus
def turnOff():
    print "turning off"
    telldus.tdTurnOff(1)