<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[UI Flow MQTT code on M5Stack Core works when run from flow.m5stack.com but not (MQTTException -&gt; 128) when downloaded to device]]></title><description><![CDATA[<p dir="auto">I used a Win 11 laptop for development and using M5Burner burned the v1.10.9 UI Flow firmware to M5 Core device and configure its WiFi to my local SSID.</p>
<p dir="auto">I next connected to the device (which is successfully online in internet mode) to xxxxxxxx from <a href="https://flow.m5stack.com/" target="_blank" rel="noopener noreferrer nofollow ugc">https://flow.m5stack.com/</a></p>
<p dir="auto">I then made a minimal MQTT connect and publish program to a public test MQTT broker and published a message.</p>
<p dir="auto">from m5stack import *<br />
from m5ui import *<br />
from uiflow import *<br />
from m5mqtt import M5mqtt</p>
<p dir="auto">setScreenColor(0x222222)</p>
<p dir="auto">m5mqtt = M5mqtt('kilnageer', '<a href="http://test.mosquitto.org" target="_blank" rel="noopener noreferrer nofollow ugc">test.mosquitto.org</a>', 1883, '', '', 300)<br />
m5mqtt.start()<br />
m5mqtt.publish(str('kilnageer/test'), str('hello'), 0)</p>
<p dir="auto">I tested the public broker with the following code..</p>
<p dir="auto">pi@tola-smarthome-v3:~ $ mosquitto_sub -h <a href="http://test.mosquitto.org" target="_blank" rel="noopener noreferrer nofollow ugc">test.mosquitto.org</a> -t kilnageer/test &amp;<br />
1 9842<br />
pi@tola-smarthome-v3:~ $<br />
pi@tola-smarthome-v3:~ $ mosquitto_pub -h <a href="http://test.mosquitto.org" target="_blank" rel="noopener noreferrer nofollow ugc">test.mosquitto.org</a> -t kilnageer/test -m "hi"<br />
pi@tola-smarthome-v3:~ $ hi</p>
<p dir="auto">pi@tola-smarthome-v3:~ $</p>
<p dir="auto">pi@tola-smarthome-v3:~ $ hello</p>
<p dir="auto">pi@tola-smarthome-v3:~ $<br />
pi@tola-smarthome-v3:~ $ date<br />
Mon 28 Nov 09:50:57 GMT 2022<br />
pi@tola-smarthome-v3:~ $</p>
<p dir="auto">So seeing "hello" proves the running the code works..</p>
<p dir="auto">Also running a web terminal to the device at this time showed no errors:</p>
<p dir="auto">Next I downloaded the code (main.m5f) to the device and so changed it from "internet" mode to "app" mode.</p>
<p dir="auto">Now I now longer see the message published and the terminal shows and MQTT error:</p>
<p dir="auto">APIKEY: xxxxxxxx<br />
MicroPython 77320d1de-dirty on 2022-11-24; M5Stack with ESP32<br />
Type "help()" for more information.<br />
&gt;&gt;&gt; [2495] MQTTException -&gt; 128<br />
reconnect start ...<br />
reconnect finish ...</p>
<p dir="auto">Also when I was developing the real code and connecting to a local Pi based MQTT broker I could see that the connection was never made (in the failing case) by looking at the mosquitto logs.</p>
<p dir="auto">pi@tola-smarthome-v3:~ $ sudo tail -f /var/log/mosquitto/mosquitto.log<br />
1669623877: New connection from 192.168.3.15 on port 1883.<br />
1669623877: New client connected from 192.168.3.15 as mqttdash-10aaf3d5 (c1, k30, u'tola').<br />
1669624454: Socket error on client mqttdash-10aaf3d5, disconnecting.</p>
<p dir="auto">But I could see the connecting being made by the M5Stack client when I just ran the code from the web console.</p>
]]></description><link>https://community.m5stack.com/topic/4845/ui-flow-mqtt-code-on-m5stack-core-works-when-run-from-flow-m5stack-com-but-not-mqttexception-128-when-downloaded-to-device</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 17:52:49 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4845.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Nov 2022 10:10:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UI Flow MQTT code on M5Stack Core works when run from flow.m5stack.com but not (MQTTException -&gt; 128) when downloaded to device on Mon, 28 Nov 2022 12:54:36 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/kilnageer" aria-label="Profile: kilnageer">@<bdi>kilnageer</bdi></a></p>
<p dir="auto">you are welcome. Thank you for reporting back. I am happy to read that it worked for you.</p>
<p dir="auto">Same to you!</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/19399</link><guid isPermaLink="true">https://community.m5stack.com/post/19399</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 28 Nov 2022 12:54:36 GMT</pubDate></item><item><title><![CDATA[Reply to UI Flow MQTT code on M5Stack Core works when run from flow.m5stack.com but not (MQTTException -&gt; 128) when downloaded to device on Tue, 29 Nov 2022 08:43:23 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Felix. That worked like a dream. I had though of doing that and then strayed to the dark side of Tasmota and Berry UI! Which is a pity because the UI Flow web GUI is superb! Enjoy your day and thanks again! :) I guess a newbie error in that "run" mode makes use of the fact the boot firmware brings it online to use the Web GUI whereas when you "download" you must do everything yourself! Happy coding.</p>
]]></description><link>https://community.m5stack.com/post/19398</link><guid isPermaLink="true">https://community.m5stack.com/post/19398</guid><dc:creator><![CDATA[kilnageer]]></dc:creator><pubDate>Tue, 29 Nov 2022 08:43:23 GMT</pubDate></item><item><title><![CDATA[Reply to UI Flow MQTT code on M5Stack Core works when run from flow.m5stack.com but not (MQTTException -&gt; 128) when downloaded to device on Mon, 28 Nov 2022 10:54:32 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/kilnageer" aria-label="Profile: kilnageer">@<bdi>kilnageer</bdi></a></p>
<p dir="auto">when the code is downloaded to the device and is run in app mode, WiFi might no longer be connected. Try adding below blocks to your program to ensure WiFi is connected.</p>
<p dir="auto"><img src="/assets/uploads/files/1669632751019-uiflowwifi_20221128.png" alt="0_1669632749798_UiFlowWiFi_20221128.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/19397</link><guid isPermaLink="true">https://community.m5stack.com/post/19397</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 28 Nov 2022 10:54:32 GMT</pubDate></item></channel></rss>