mqtt/client.py
changeset 4023 b344393859df
parent 4022 dee0efbf8452
--- a/mqtt/client.py	Thu Sep 26 15:28:10 2024 +0200
+++ b/mqtt/client.py	Mon Sep 30 16:21:11 2024 +0200
@@ -4,6 +4,7 @@
 
 import os
 import re
+import wx
 
 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
 from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT
@@ -26,9 +27,11 @@
 
 class MQTTClientEditor(ConfTreeNodeEditor):
     CONFNODEEDITOR_TABS = [
-        (_("MQTT Client"), "CreateMQTTClient_UI")]
+        (_("MQTT Client"), "CreateMQTTClient_UI"),
+        (_("Info"), "CreateInfo_UI")]
 
     MQTTClient_UI = None
+    Info_UI = None
 
     def Log(self, msg):
         self.Controler.GetCTRoot().logger.write(msg)
@@ -41,6 +44,15 @@
             self.Controler.GetTypes)
         return self.MQTTClient_UI
 
+    def CreateInfo_UI(self, parent):
+        location_str = "_".join(map(str, self.Controler.GetCurrentLocation()))
+        information=("Connection status GLOBAL VAR is:\n\n\tMQTT_STATUS_"+location_str
+                    +", of type INT.\n\t"
+                    +"0 is disconnected\n\t"
+                    +"1 is connected\n")
+        self.Info_UI = wx.StaticText(parent, label = information)
+        return self.Info_UI
+
     def RefreshView(self):
         if(self.MQTTClient_UI):
             self.MQTTClient_UI.RefreshView()
@@ -224,6 +236,7 @@
 
     def CTNGlobalInstances(self):
         location_str = "_".join(map(str, self.GetCurrentLocation()))
-        return [("MQTT_HAPPY_"+location_str, "DINT", "")]
-
-
+        return [("MQTT_STATUS_"+location_str, "INT", ""),
+               ]
+
+