rabin 7 years ago
parent
commit
6827830110
2 changed files with 5 additions and 8 deletions
  1. 3 3
      front/page/device.py
  2. 2 5
      service/device.py

+ 3 - 3
front/page/device.py

@@ -65,7 +65,7 @@ class mul_path(Load):
 				if info['devices']:
 					devices = tuple(eval(info['devices']))
 					for device in devices:
-						Demeter.service('device').switch(device, value, id)
+						Demeter.service('device').switch(device, switch=value, mul=id)
 			self.out('yes', {'id':id})
 		else:
 			self.out('no')
@@ -659,7 +659,7 @@ class update_path(Load):
 		id = self.input('id')
 		value = self.input('value')
 		if id:
-			Demeter.service('device').switch(id, value)
+			Demeter.service('device').switch(id, switch=value)
 			
 			self.out('yes', {'id':id})
 			"""
@@ -682,7 +682,7 @@ class update_path(Load):
 
 	@tornado.gen.coroutine
 	def switch(self, id, value):
-		Demeter.service('device').switch(id, value)
+		Demeter.service('device').switch(id, switch=value)
 
 class get_path(Load):
 	@Web.auth

+ 2 - 5
service/device.py

@@ -149,8 +149,8 @@ class Device(object):
 		oper = ''
 		type_model = Demeter.model('device_type')
 		type_model.id = type_id
-		self.type_info = type_model.select(type='fetchone')
-		if self.type_info['unit'] == 'button':
+		type_info = type_model.select(type='fetchone')
+		if type_info['unit'] == 'button':
 			if switch == 1:
 				oper = '升起'
 			elif switch == 2:
@@ -176,9 +176,6 @@ class Device(object):
 				model.status = 1
 				model.device_id = info['id']
 				oper = self.msg(info['type_id'], v['value']) + msg
-			#判断是不是卷帘类的按钮,如果是,要等15秒。。
-			if self.type_info['unit'] == 'button':
-				time.sleep(15)
 			if state:
 				model.update(status=2, oper=oper, operdate=Demeter.time())
 			else: