From f492dd30922c63e87ee773dfd458e0cc9ca7d5af Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Fri, 23 Jan 2026 11:57:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87=E7=AB=AF?= =?UTF-8?q?=E7=89=A9=E6=A8=A1=E5=9E=8B=E8=A7=A3=E9=99=A4=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE=E5=B1=9E=E6=80=A7=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceAggregationService.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs index 744fd35..e0da061 100644 --- a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs +++ b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs @@ -1090,8 +1090,20 @@ namespace JiShe.IoT.DeviceAggregation } else if (input.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand)) { - //非绑定物模型情况下,SpecialCommand还原默认值,设备也会恢复默认采集方式 - input.Commands[ThingModelFixedTypeConst.SpecialCommand] = CommonConst.SpecialCommandDefaultValue; + //设备端物模型解除绑定情况下,SpecialCommand 还原默认值,设备也会恢复默认采集方式 + //给SpecialCommand第一个参数设置默认值 + + var propertyInfo = await oneNETProductService.GetProductThingModelSpecialCommandDataTypeListAsync(new IdInput() { Id = deviceInfo.IoTPlatformProductId }); + + if (propertyInfo == null) + { + throw new UserFriendlyException($"{nameof(DeviceCommandInfoToOneNET)} OneNET设备属性设置失败,产品Id{deviceInfo.IoTPlatformProductId}未找到对应的属性信息。"); + } + string paName = propertyInfo.FirstOrDefault()?.Identifier; + + input.Commands[ThingModelFixedTypeConst.SpecialCommand] = new Dictionary() { + { paName, CommonConst.SpecialCommandDefaultValue } + }; logger.LogWarning($"{nameof(DeviceCommandInfoToOneNET)} OneNET平台设备{deviceInfo.DeviceAddress}特殊抄读指令还原为{CommonConst.SpecialCommandDefaultValue}"); }