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}"); }