Ejemplo n.º 1
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)
Ejemplo n.º 2
0
 def tellstick_turnon(tdev):
     """Turn on a telldus device"""
     self.tellstick_acquire()
     try:
         methods = telldus.tdMethods(tdev, self.ALL_METHODS)
         if methods & self.TELLSTICK_TURNON:
             telldus.tdTurnOn(tdev)
             time.sleep(self._lock_delay)
     except Exception:
         logger.exception('[%s] - Exception when tellstick_turnon', self.__class__.__name__)
     finally:
         self.tellstick_release()
Ejemplo n.º 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)
Ejemplo n.º 4
0
 def tellstick_turnon(tdev):
     """Turn on a telldus device"""
     self.tellstick_acquire()
     try:
         methods = telldus.tdMethods(tdev, self.ALL_METHODS)
         if methods & self.TELLSTICK_TURNON:
             telldus.tdTurnOn(tdev)
             time.sleep(self._lock_delay)
     except Exception:
         logger.exception('[%s] - Exception when tellstick_turnon',
                          self.__class__.__name__)
     finally:
         self.tellstick_release()
Ejemplo n.º 5
0
def turnOn():
	print "turning on"
	telldus.tdTurnOn(1)
Ejemplo n.º 6
0
allMethods = telldus.TELLSTICK_TURNON | telldus.TELLSTICK_TURNOFF | telldus.TELLSTICK_BELL | telldus.TELLSTICK_DIM

for i in xrange(devices):
	deviceid = telldus.tdGetDeviceId(i)

	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"
			
Ejemplo n.º 7
0
def turnOn():
    print "turning on"
    telldus.tdTurnOn(1)