From ed1bf62d90197e43e301f128dc131bd549bd574d Mon Sep 17 00:00:00 2001 From: "de@itstall.de" <de@itstall.de> Date: Mon, 3 Feb 2020 17:21:07 +0100 Subject: [PATCH] Set frontendId as ClientId for MQTT --- Wetterstation/Form1.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Wetterstation/Form1.cs b/Wetterstation/Form1.cs index c0badb3..9bb1292 100644 --- a/Wetterstation/Form1.cs +++ b/Wetterstation/Form1.cs @@ -76,26 +76,19 @@ namespace Wetterstation lbDatum.Text = DateTime.Now.ToShortDateString(); } - - - - - //MQTT connect public void mqttStart() { String topic_publish = "/wetterstation/backend/" + WeatherstationSettings.frontendId + "/"; String topic_subscribe = "/wetterstation/frontend/" + WeatherstationSettings.frontendId + "/#"; - System.Console.WriteLine("Hello, World!"); // Create Client instance this.myClient = new MqttClient("mqtt.itstall.de"); // Register to message received myClient.MqttMsgPublishReceived += client_recievedMessage; - string clientId = Guid.NewGuid().ToString(); - this.myClient.Connect("", "wetterstation", "wetterstation"); + this.myClient.Connect(WeatherstationSettings.frontendId, "wetterstation", "wetterstation"); // Subscribe to topic this.myClient.Subscribe(new String[] { topic_subscribe }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE }); -- GitLab