--- a/LPCMQTT.py Tue Jan 21 09:25:40 2025 +0100
+++ b/LPCMQTT.py Wed Jan 22 11:42:33 2025 +0100
@@ -5,6 +5,12 @@
orig_CTNGenerate_C = MQTTClient.CTNGenerate_C
def CTNGenerate_C(self, buildpath, locations):
+ res = orig_CTNGenerate_C(self, buildpath, locations) + is_SmartehCloud = self.GetParamsAttributes(u"MQTTClient.Authtype") == u"SmartehCloud" + if not is_SmartehCloud: location_str = "_".join(map(str, self.GetCurrentLocation()))
name_str = self.BaseParams.getName()
@@ -22,18 +28,15 @@
LPCTopic = "/smarteh/"+common_functions.getLPCSerialFromMAC()+"/command"
def _{location}_topic_callback(topic, payload):
- print("got data:", payload)
proc = Popen([os.path.join(os.path.dirname(common_functions.__file__), 'mqtt_command.sh')], stdin=PIPE)
proc.stdin.write(payload)
def _runtime_{location}_mqtt_start():
MQTT_subscribe("{name}", LPCTopic, _{location}_topic_callback)
- print("mqtt register", LPCTopic)
def _runtime_{location}_mqtt_stop():
""".format(location = location_str,
@@ -41,8 +44,7 @@
- return orig_CTNGenerate_C(self, buildpath, locations) + (
- ("runtime_%s_mqtt.py" % location_str, open(runtimefile_path, "rb")),)
+ return res + (("runtime_%s_mqtt.py" % location_str, open(runtimefile_path, "rb")),) MQTTClient.CTNGenerate_C = CTNGenerate_C
@@ -58,7 +60,6 @@
<xsd:element name="SmartehCloud"/>
MQTTClient.XSD = "".join(xsd_frags)
orig_GetConfig = MQTTClient.GetConfig
@@ -72,3 +73,4 @@
"TrustStore": "/media/data/keystore/cloud/TrustStore.pem"})
MQTTClient.GetConfig = GetConfig