组态使用mqtt推送

This commit is contained in:
iioter 2022-09-05 15:32:55 +08:00
parent 15c33ed8f1
commit 24c757087c
2 changed files with 4 additions and 4 deletions

View File

@ -120,7 +120,7 @@ namespace Plugin
ret.CookedValue?.ToString()) ret.CookedValue?.ToString())
{ {
//这是设备变量列表要用的 //这是设备变量列表要用的
var msg = new InjectedMqttApplicationMessage( var msgInternal = new InjectedMqttApplicationMessage(
new MqttApplicationMessage() new MqttApplicationMessage()
{ {
Topic = Topic =
@ -128,9 +128,9 @@ namespace Plugin
Payload = Encoding.UTF8.GetBytes( Payload = Encoding.UTF8.GetBytes(
JsonConvert.SerializeObject(ret)) JsonConvert.SerializeObject(ret))
}); });
mqttServer.InjectApplicationMessage(msg); mqttServer.InjectApplicationMessage(msgInternal);
//这是在线组态要用的 //这是在线组态要用的
msg = new InjectedMqttApplicationMessage( var msgConfigure = new InjectedMqttApplicationMessage(
new MqttApplicationMessage() new MqttApplicationMessage()
{ {
Topic = Topic =
@ -138,7 +138,7 @@ namespace Plugin
Payload = Encoding.UTF8.GetBytes( Payload = Encoding.UTF8.GetBytes(
JsonConvert.SerializeObject(ret.CookedValue)) JsonConvert.SerializeObject(ret.CookedValue))
}); });
mqttServer.InjectApplicationMessage(msg); mqttServer.InjectApplicationMessage(msgConfigure);
} }
DeviceValues[item.ID] = ret; DeviceValues[item.ID] = ret;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB