|
@@ -106,6 +106,10 @@ class GatewaySubDeviceView(View):
|
|
if sub_device_qs.exists():
|
|
if sub_device_qs.exists():
|
|
sub_device_qs.update(src_addr=src_addr) # 更新短地址
|
|
sub_device_qs.update(src_addr=src_addr) # 更新短地址
|
|
return response.json(174)
|
|
return response.json(174)
|
|
|
|
+ if device_type == SENSOR_TYPE['smart_button']:
|
|
|
|
+ sub_device_qs = GatewaySubDevice.objects.filter(device_id=device_id, device_type=device_type)
|
|
|
|
+ if sub_device_qs.exists():
|
|
|
|
+ return response.json(174)
|
|
|
|
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
sub_device = GatewaySubDevice.objects.create(device_id=device_id, device_type=device_type,
|
|
sub_device = GatewaySubDevice.objects.create(device_id=device_id, device_type=device_type,
|