修复设备端物模型解除绑定时设置属性失败的问题

This commit is contained in:
ChenYi 2026-01-23 11:57:40 +08:00
parent f951a0eedc
commit f492dd3092

View File

@ -1090,8 +1090,20 @@ namespace JiShe.IoT.DeviceAggregation
} }
else if (input.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand)) else if (input.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand))
{ {
//非绑定物模型情况下SpecialCommand还原默认值设备也会恢复默认采集方式 //设备端物模型解除绑定情况下SpecialCommand 还原默认值,设备也会恢复默认采集方式
input.Commands[ThingModelFixedTypeConst.SpecialCommand] = CommonConst.SpecialCommandDefaultValue; //给SpecialCommand第一个参数设置默认值
var propertyInfo = await oneNETProductService.GetProductThingModelSpecialCommandDataTypeListAsync(new IdInput<string>() { 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<string, object>() {
{ paName, CommonConst.SpecialCommandDefaultValue }
};
logger.LogWarning($"{nameof(DeviceCommandInfoToOneNET)} OneNET平台设备{deviceInfo.DeviceAddress}特殊抄读指令还原为{CommonConst.SpecialCommandDefaultValue}"); logger.LogWarning($"{nameof(DeviceCommandInfoToOneNET)} OneNET平台设备{deviceInfo.DeviceAddress}特殊抄读指令还原为{CommonConst.SpecialCommandDefaultValue}");
} }