Selaa lähdekoodia

修复智能按钮更新紧急状态问题

locky 2 vuotta sitten
vanhempi
commit
59908961ff
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      Controller/gatewayController.py

+ 2 - 2
Controller/gatewayController.py

@@ -71,7 +71,6 @@ class GatewayView(View):
         n_time = int(time.time())
 
         try:
-            nickname = serial_number
             # 查询子设备表id
             gateway_sub_device_qs = GatewaySubDevice.objects.filter(device__serial_number=serial_number,
                                                                     device_type=sensor_type, ieee_addr=ieee_addr,
@@ -100,7 +99,8 @@ class GatewayView(View):
 
                 # (门磁,烟雾,人体)传感器被拆动/拆动恢复,修改拆动状态
                 if sensor_status:
-                    gateway_sub_device_qs.update(is_tampered=1)
+                    if sensor_type != SENSOR_TYPE['smart_button']:  # 智能按钮不更新
+                        gateway_sub_device_qs.update(is_tampered=1)
                 elif sensor_type == SENSOR_TYPE['door_magnet'] or sensor_type == SENSOR_TYPE['smoke_sensor'] or \
                         sensor_type == SENSOR_TYPE['body_sensor']:
                     gateway_sub_device_qs.update(is_tampered=0)