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

预设亮度没有缓慢开关

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

+ 10 - 22
Controller/SensorGateway/SmartSwitchController.py

@@ -221,7 +221,7 @@ class SmartSwitchView(View):
         end_time = request_dict.get('endTime', None)
         actions = request_dict.get('actions', None)
         actions_type = request_dict.get('actionsType', None)
-        slow_speed = request_dict.get('slowSpeed', None)
+        slow_speed = request_dict.get('slowSpeed', 0)
         repeat = request_dict.get('repeat', None)
 
         if not all([device_id, repeat]):
@@ -232,27 +232,15 @@ class SmartSwitchView(View):
         if time_type_radio == 1:  # 时间点
             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'})
+            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 time_type_radio == 2:  # 时间段
             if not all([start_time, end_time]):
                 return response.json(444, {'param': 'startTime,endTime'})