FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
12-17-2021 09:56 AM
Hello everyone,
Has anyone sucessfuly used the MQTT blocks in the IDE App's Visual Coding Environment?
I set up a local MQTT broker and configured it in the tiger editor. However, when I try to subscribe or publish a message, I get an error "1234 NameError("name 'url' is not defined",)" threw by the get_connected_client function of the mqtt class:
def get_connected_client(self): if not self.connect_started: self.connect_started = True self.client.connect(url, port) threading.Thread(target=self.client.loop_forever).start() return self.client
It seems that the mqtt object does not recognize the url variable, which might be caused by the fact that this value is not stored in the __init__ function:
def __init__(self, url, port, encrypted): self.client = paho_mqtt_client.Client('tiger') self.client.on_message = lambda client, userdata, message: events.emit( 'mqtttopic' + message.topic, 'message', message.payload.decode("utf-8")) if encrypted: self.client.tls_set() proxy = os.environ.get('HTTP_PROXY') or os.environ.get('http_proxy') if proxy: proxy = re.search(r"^\w*:\/\/(.*):(\d*)", proxy) self.client.proxy_set(proxy_type=3, proxy_addr=proxy.group(1), proxy_port=int(proxy.group(2)))
I tried to adjust the code in the textual coding envirnoment but it did not change the code stored in the blocks. Has anyone encountered (and hopefully solved) a similar issue?
Solved! Go to Solution.
01-12-2022 01:03 PM
We found that there is a bug in the MQTT extension in the IDE app that will be fixed in the patch for the actual Release RM21.1 (v1.12.1). Actually there is no workaround up to then.
05-17-2022 11:24 AM
Did you do some tests with a new version? Can this topic be closed.