<?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[UiFlow 2.0 AirQ support, Custom Code will not work...]]></title><description><![CDATA[<p dir="auto">Hi, New to M5Stack here, I am trying to wrap my head around the way things work with ESP32 devices and get some data flowing to a mosquitto MQTT broker, I have tried to get the MQTT publish to work via UIFlow 2.0 but so far absolutely no luck get anything at all to work on the device, The Demo works fine, Lets me connect WiFi then exposes the sensor data via its pre-configured web-page view, This all works without any issue, As soon as i flash it with a UIFlow custom config all i get from the monitor is:</p>
<p dir="auto">_   <em>(</em>)/ <em>| | _____      __<br />
| | | | | |</em>| |/ _ \ \ /\ / /<br />
| |<em>| | |  <em>| | (</em>) \ V  V /<br />
_</em>,<em>|</em>|<em>| |</em>|___/ _/_/</p>
<p dir="auto">[INFO] Syncing resources...<br />
[WARN] WiFi not connected.<br />
[WARN] quit sync.<br />
MicroPython v1.24.0-dirty on 2024-11-21; M5STACK AirQ with ESP32-S3-FN8<br />
Type "help()" for more information.</p>
<p dir="auto">I have tried even basic setups to just get a label to appear on the screen but all i get is this.</p>
<p dir="auto">Here is the code for my blocks:</p>
<p dir="auto">import os, sys, io<br />
import M5<br />
from M5 import *<br />
import time<br />
import network<br />
from umqtt import *<br />
from hardware import *</p>
<p dir="auto">wifiStatus = None<br />
mqttStatus = None<br />
rssiStatus = None<br />
ipAddress = None<br />
wlan = None<br />
mqtt_client = None<br />
scd40 = None</p>
<p dir="auto">def setup():<br />
global wifiStatus, mqttStatus, rssiStatus, ipAddress, wlan, mqtt_client, scd40</p>
<p dir="auto">M5.begin()<br />
wifiStatus = Widgets.Label("wifiStatus", 4, 5, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)<br />
mqttStatus = Widgets.Label("mqttStatus", 3, 109, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)<br />
rssiStatus = Widgets.Label("rssiStatus", 5, 25, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)<br />
ipAddress = Widgets.Label("ipAddress", 5, 47, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)</p>
<p dir="auto">time.sleep(5)<br />
wifiStatus.setVisible(True)<br />
mqttStatus.setVisible(True)<br />
rssiStatus.setVisible(True)<br />
ipAddress.setVisible(True)<br />
scd40 = SCD40()<br />
wlan = network.WLAN(network.STA_IF)<br />
while not (wlan.isconnected()):<br />
wlan.active(False)<br />
wlan.active(True)<br />
wlan.config(reconnects=5)<br />
wlan.config(dhcp_hostname='m5stackAirQ')<br />
wlan.connect('SPARK-S7K39H', '&lt;MyPassword&gt;')<br />
time.sleep(3)<br />
wifiStatus.setText(str('WiFi Connected..'))<br />
mqtt_client = MQTTClient('AirQ-Test', '192.168.1.83', port=1883, user='admin', password='&lt;MyPassword&gt;', keepalive=5334)<br />
mqtt_client.connect(clean_session=True)<br />
mqttStatus.setText(str('MQTT Connected..'))<br />
mqtt_client.publish('signal-test/temperature', 'Hello World From Setup Complete!!', qos=0)</p>
<p dir="auto">def loop():<br />
global wifiStatus, mqttStatus, rssiStatus, ipAddress, wlan, mqtt_client, scd40<br />
M5.update()<br />
if wlan.isconnected():<br />
wifiStatus.setColor(0x33ff33, 0x000000)<br />
rssiStatus.setColor(0x33ff33, 0x000000)<br />
ipAddress.setColor(0x33ff33, 0x000000)<br />
rssiStatus.setText(str(wlan.status('rssi')))<br />
ipAddress.setText(str(wlan.ifconfig()[0]))<br />
else:<br />
wifiStatus.setColor(0xff0000, 0x000000)<br />
rssiStatus.setColor(0xff0000, 0x000000)<br />
rssiStatus.setText(str('--'))<br />
wlan.active(False)<br />
wlan.active(True)<br />
wlan.config(reconnects=5)<br />
wlan.config(dhcp_hostname='m5stackAirQ')<br />
wlan.connect('SPARK-S7K39H', '&lt;MyPassword&gt;')<br />
mqtt_client.publish('/test/temp', str((scd40.temperature)), qos=0)<br />
time.sleep(5)</p>
<p dir="auto">if <strong>name</strong> == '<strong>main</strong>':<br />
try:<br />
setup()<br />
while True:<br />
loop()<br />
except (Exception, KeyboardInterrupt) as e:<br />
try:<br />
from utility import print_error_msg<br />
print_error_msg(e)<br />
except ImportError:<br />
print("please update to latest firmware")</p>
<p dir="auto">All I am trying to do here is make sure the device attempts to connect to the WiFi, Then try a connection to the MQTT Broker, Initialize the sensors for scd40 and send a value to my broker, The broker is working and I have been able to connect using MQTT Explorer and send messages to topics, The issue here is the hardware will not accept custom UIFlow code, Im completely stuck dead in the water here and struggling to find any decent support.</p>
<p dir="auto">Much appreciation in advance, Thanks!</p>
]]></description><link>https://community.m5stack.com/topic/7177/uiflow-2-0-airq-support-custom-code-will-not-work</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 06:49:49 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7177.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Jan 2025 05:04:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UiFlow 2.0 AirQ support, Custom Code will not work... on Thu, 09 Jan 2025 06:14:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vipernz" aria-label="Profile: ViperNZ">@<bdi>ViperNZ</bdi></a> Take it back to the basics of just a label, test and then add each block untill the error happens and then post the error message from the console.</p>
]]></description><link>https://community.m5stack.com/post/27822</link><guid isPermaLink="true">https://community.m5stack.com/post/27822</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 09 Jan 2025 06:14:38 GMT</pubDate></item></channel></rss>