dever 4 years ago
parent
commit
f24b2d2ab3
1 changed files with 4 additions and 4 deletions
  1. 4 4
      service/device.py

+ 4 - 4
service/device.py

@@ -466,6 +466,10 @@ class Device(object):
 		if not state:
 			feedback = self.send_pub(type_info, gateway_info, info, switch)
 
+		config = {'method':'control', 'type':type_info['key'], 'parent':gateway_info['hardware_id'], 'child':info['hardware_id']}
+		name = type_info['name'] + '#' + str(info['hardware_id'])
+		self.save(config, switch, name, type_info)
+
 		return feedback
 
 	def send_modbus_tcp(self, type_info, gateway_info, info, value, server):
@@ -483,8 +487,4 @@ class Device(object):
 		#pub.push(update, value, qos=0, callback=self.switchAction, param={'info':info, 'key':feedback, 'switch':switch}, feedback=True)
 		pub.push(update, value)
 
-		config = {'method':'control', 'type':type_info['key'], 'parent':gateway_info['hardware_id'], 'child':info['hardware_id']}
-		name = type_info['name'] + '#' + str(info['hardware_id'])
-		self.save(config,value, name, type_info)
-
 		return feedback