优化内部mqtt消息
This commit is contained in:
parent
47f869924e
commit
936b5c67f5
Binary file not shown.
@ -125,7 +125,12 @@
|
||||
"ProjectGuid": "8e2d91dc-dee4-4843-8d09-6fc06651527e",
|
||||
"DisplayName": "DriverModbusMaster",
|
||||
"ColorIndex": 7
|
||||
},
|
||||
"7752ad8c-04bf-4bd2-9272-cda4f78fa954": {
|
||||
"ProjectGuid": "7752ad8c-04bf-4bd2-9272-cda4f78fa954",
|
||||
"DisplayName": "PluginInterface",
|
||||
"ColorIndex": 8
|
||||
}
|
||||
},
|
||||
"NextColorIndex": 8
|
||||
"NextColorIndex": 9
|
||||
}
|
Binary file not shown.
@ -104,14 +104,19 @@ namespace Plugin
|
||||
|
||||
//变化了才推送到mqttserver,用于前端展示
|
||||
if (DeviceValues[item.ID].StatusType != ret.StatusType || DeviceValues[item.ID].Value?.ToString() != ret.Value?.ToString() || DeviceValues[item.ID].CookedValue?.ToString() != ret.CookedValue?.ToString())
|
||||
{
|
||||
//这是设备变量列表要用的
|
||||
mqttServer.PublishAsync($"internal/v1/gateway/telemetry/{Device.DeviceName}/{item.Name}", JsonConvert.SerializeObject(ret));
|
||||
//这是在线组态要用的
|
||||
mqttServer.PublishAsync($"v1/gateway/telemetry/{Device.DeviceName}/{item.Name}", JsonConvert.SerializeObject(ret.CookedValue));
|
||||
}
|
||||
|
||||
DeviceValues[item.ID] = ret;
|
||||
|
||||
}
|
||||
payLoad.TS = (long)(DateTime.Now - TsStartDt).TotalMilliseconds;
|
||||
|
||||
if (DeviceValues.Any(x => x.Value.StatusType != VaribaleStatusTypeEnum.Good))
|
||||
if (DeviceValues.Any(x => x.Value.Value ==null))
|
||||
{
|
||||
payLoad.Values = null;
|
||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Bad;
|
||||
|
@ -14,7 +14,7 @@ namespace PluginInterface
|
||||
public object CookedValue { get; set; }
|
||||
public string Message { get; set; }
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public VaribaleStatusTypeEnum StatusType { get; set; }
|
||||
public VaribaleStatusTypeEnum StatusType { get; set; } = VaribaleStatusTypeEnum.UnKnow;
|
||||
public Guid VarId { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user