Example #1
0
	def P_sleeptimer(self, request):
		cmd = "get"
		if "cmd" in request.args.keys():
			cmd = request.args["cmd"][0]

		if cmd == "get":
			return getSleepTimer(self.session)

		time = None
		if "time" in request.args.keys():
			ttime = request.args["time"][0]
			try:
				time = int(ttime)
				if time > 999:
					time = 999
				elif time < 0:
					time = 0
			except ValueError:
				pass

		action = "standby"
		if "action" in request.args.keys():
			action = request.args["action"][0]

		enabled = None
		if "enabled" in request.args.keys():
			if request.args["enabled"][0] == "True":
				enabled = True
			elif request.args["enabled"][0] == "False":
				enabled = False

		ret = getSleepTimer(self.session)

		if cmd != "set":
			ret["message"] = "ERROR: Obligatory parameter 'cmd' [get,set] has unspecified value '%s'" % cmd
			return ret

		if time == None and enabled == True:	# it's used only if the timer is enabled
			ret["message"] = "ERROR: Obligatory parameter 'time' [0-999] is missing"
			return ret

		if enabled == None:
			ret["message"] = "Obligatory parameter 'enabled' [True,False] is missing"
			return ret

		return setSleepTimer(self.session, time, action, enabled)
Example #2
0
	def P_sleeptimer(self, request):
		cmd = "get"
		if "cmd" in request.args.keys():
			cmd = request.args["cmd"][0]

		if cmd == "get":
			return getSleepTimer(self.session)

		time = None
		if "time" in request.args.keys():
			ttime = request.args["time"][0]
			try:
				time = int(ttime)
				if time > 999:
					time = 999
				elif time < 0:
					time = 0
			except ValueError:
				pass

		action = "standby"
		if "action" in request.args.keys():
			action = request.args["action"][0]

		enabled = None
		if "enabled" in request.args.keys():
			if request.args["enabled"][0] == "True":
				enabled = True
			elif request.args["enabled"][0] == "False":
				enabled = False

		ret = getSleepTimer(self.session)

		if cmd != "set":
			ret["message"] = "ERROR: Obligatory parameter 'cmd' [get,set] has unspecified value '%s'" % cmd
			return ret

		if time == None and enabled == True:	# it's used only if the timer is enabled
			ret["message"] = "ERROR: Obligatory parameter 'time' [0-999] is missing"
			return ret

		if enabled == None:
			ret["message"] = "Obligatory parameter 'enabled' [True,False] is missing"
			return ret

		return setSleepTimer(self.session, time, action, enabled)
	def P_sleeptimer(self, request):
		cmd = "get"
		if "cmd" in request.args.keys():
			cmd = request.args["cmd"][0]
			
		if cmd == "get":
			return getSleepTimer(self.session)
			
		time = None
		if "time" in request.args.keys():
			ttime = request.args["time"][0]
			try:
				time = int(ttime)
				if time > 999:
					time = 999
				elif time < 0:
					time = 0
			except Exception, e:
				pass
Example #4
0
    def P_sleeptimer(self, request):
        cmd = "get"
        if "cmd" in request.args.keys():
            cmd = request.args["cmd"][0]

        if cmd == "get":
            return getSleepTimer(self.session)

        time = None
        if "time" in request.args.keys():
            ttime = request.args["time"][0]
            try:
                time = int(ttime)
                if time > 999:
                    time = 999
                elif time < 0:
                    time = 0
            except Exception, e:
                pass
					time = 0
			except Exception, e:
				pass
				
		action = "standby"
		if "action" in request.args.keys():
			action = request.args["action"][0]
		
		enabled = None
		if "enabled" in request.args.keys():
			if request.args["enabled"][0] == "True":
				enabled = True
			elif request.args["enabled"][0] == "False":
				enabled = False
		
		ret = getSleepTimer(self.session)
		
		if cmd != "set":
			ret["message"] = "ERROR: Obligatory parameter 'cmd' [get,set] has unspecified value '%s'" % cmd
			return ret
			
		if time == None and enabled == True:	# it's used only if the timer is enabled
			ret["message"] = "ERROR: Obligatory parameter 'time' [0-999] is missing"
			return ret
		
		if enabled == None:
			ret["message"] = "Obligatory parameter 'enabled' [True,False] is missing"
			return ret
			
		return setSleepTimer(self.session, time, action, enabled)
		
Example #6
0
                    time = 0
            except Exception, e:
                pass

        action = "standby"
        if "action" in request.args.keys():
            action = request.args["action"][0]

        enabled = None
        if "enabled" in request.args.keys():
            if request.args["enabled"][0] == "True":
                enabled = True
            elif request.args["enabled"][0] == "False":
                enabled = False

        ret = getSleepTimer(self.session)

        if cmd != "set":
            ret["message"] = "ERROR: Obligatory parameter 'cmd' [get,set] has unspecified value '%s'" % cmd
            return ret

        if time == None and enabled == True:  # it's used only if the timer is enabled
            ret["message"] = "ERROR: Obligatory parameter 'time' [0-999] is missing"
            return ret

        if enabled == None:
            ret["message"] = "Obligatory parameter 'enabled' [True,False] is missing"
            return ret

        return setSleepTimer(self.session, time, action, enabled)