When using Software MQTT Component, the code genrated is wrong. Because the "Subscribe" Block is not a "Statement" but a "Root" block, I can't change the subscribe action after mqtt successfully initialized. So the generated code looks like this:
def setup():
global kb, mqtt_client ......
==========BAD CODE HERE================
mqtt_client.subscribe('/cardputer', mqtt__cardputer_event, qos=0)
=====================================
M5.begin()
kb = MatrixKeyboard()
kb.set_callback(kb_pressed_event)
mqtt_client = MQTTClient('cardputer', 'xxx.xxx.xxx.xxx', port=1883, user='xxx', password='xxx', keepalive=0)
mqtt_client.reconnect()
.....
Note that the subscribe code generated Even Before M5.begin()!
You have to fix this BLOCKING Issue asap to make the block coding mqtt code useful. I can now only manually modify code to make sure the subscribe action works.