Kaynağa Gözat

task的sensor_type和sensor_action转int

locky 3 yıl önce
ebeveyn
işleme
966676cf21

+ 4 - 4
Controller/SensorGateway/SmartSceneController.py

@@ -297,8 +297,8 @@ class SmartSceneView(View):
                 task_list = []
                 task_list = []
                 for task in tasks_list:
                 for task in tasks_list:
                     task_temp = {
                     task_temp = {
-                        'sensor_type': task['device_type'],
-                        'sensor_action': task['event_type']
+                        'sensor_type': int(task['device_type']),
+                        'sensor_action': int(task['event_type'])
                     }
                     }
                     sub_device_id = task.get('subDeviceId', None)
                     sub_device_id = task.get('subDeviceId', None)
                     if sub_device_id:
                     if sub_device_id:
@@ -543,8 +543,8 @@ class SmartSceneView(View):
             task_list = []
             task_list = []
             for task in tasks_list:
             for task in tasks_list:
                 task_temp = {
                 task_temp = {
-                    'sensor_type': task['device_type'],
-                    'sensor_action': task['event_type']
+                    'sensor_type': int(task['device_type']),
+                    'sensor_action': int(task['event_type'])
                 }
                 }
                 task_sub_device_id = task.get('subDeviceId', None)
                 task_sub_device_id = task.get('subDeviceId', None)
                 if task_sub_device_id:
                 if task_sub_device_id:

+ 1 - 1
Controller/SensorGateway/SubDeviceController.py

@@ -219,7 +219,7 @@ class GatewaySubDeviceView(View):
         now_time = int(time.time())
         now_time = int(time.time())
         # 判断event_type
         # 判断event_type
         event_type = int(event_type)
         event_type = int(event_type)
-        if event_type != 2200 or event_type != 2201:
+        if event_type != 2200 and event_type != 2201:
             return response.json(444, {'invalid eventType': event_type})
             return response.json(444, {'invalid eventType': event_type})
 
 
         try:
         try: