Эх сурвалжийг харах

预设亮度没有缓慢开关

peng 1 жил өмнө
parent
commit
e65094aabe

+ 23 - 11
Controller/SensorGateway/SmartSwitchController.py

@@ -230,17 +230,29 @@ class SmartSwitchView(View):
         if not device_qs.exists():
             return response.json(173)
         if time_type_radio == 1:  # 时间点
-            if not all([time_point, slow_speed]):
-                return response.json(444, {'param': 'timePoint,slowSpeed'})
-            scheduler_data = {
-                'device_id': device_id,
-                'time_type_radio': time_type_radio,
-                'time_point': time_point,
-                'actions': actions,
-                'actions_type': actions_type,
-                'slow_speed': slow_speed,
-                'repeat': repeat
-            }
+            if not all([time_point]):
+                return response.json(444, {'param': 'timePoint'})
+            if actions_type == '1':
+                scheduler_data = {
+                    'device_id': device_id,
+                    'time_type_radio': time_type_radio,
+                    'time_point': time_point,
+                    'actions': actions,
+                    'actions_type': actions_type,
+                    'slow_speed': slow_speed,
+                    'repeat': repeat
+                }
+            elif actions_type == '2':
+                scheduler_data = {
+                    'device_id': device_id,
+                    'time_type_radio': time_type_radio,
+                    'time_point': time_point,
+                    'actions': actions,
+                    'actions_type': actions_type,
+                    'repeat': repeat
+                }
+            else:
+                return response.json(444, {'param': 'actionsType'})
         elif time_type_radio == 2:  # 时间段
             if not all([start_time, end_time]):
                 return response.json(444, {'param': 'startTime,endTime'})