Browse Source

修改编辑场景接口

locky 3 years ago
parent
commit
bee3fc3e32

+ 10 - 0
Controller/SensorGateway/SmartSceneController.py

@@ -518,6 +518,16 @@ class SmartSceneView(View):
             if conditions_dict['type'] == 2:  # 条件为选择子设备
                 if not sub_device_id:
                     return response.json(444, {'error param': 'subDeviceId'})
+
+                # 智能按钮不能创建触发条件相同的场景
+                device_type = conditions_dict['sensor']['device_type']
+                if device_type == '216':
+                    event_type = conditions_dict['sensor']['eventValues'][0]['event_type']
+                    smart_scene_qs = SmartScene.objects.filter(sub_device_id=sub_device_id,
+                                                               conditions__contains=event_type)
+                    if smart_scene_qs.exists():
+                        return response.json(180)
+
                 device_id = ''
                 sub_device_qs = GatewaySubDevice.objects.filter(id=sub_device_id).values('src_addr').first()
                 msg['smart_scene_id'] = smart_scene_id

+ 1 - 0
Controller/SensorGateway/SubDeviceController.py

@@ -433,6 +433,7 @@ class GatewaySubDeviceView(View):
         更新智能按钮紧急开关状态
         @param request_dict: 请求参数
         @request_dict gatewaySubId: 子设备id
+        @request_dict emergencyStatus: 紧急开关状态,0:关,1:开
         @param response: 响应对象
         @return: response
         """