diff --git a/boards/default_src/micropython/blocks/iot.js b/boards/default_src/micropython/blocks/iot.js
index e909daba..45fa6fc6 100644
--- a/boards/default_src/micropython/blocks/iot.js
+++ b/boards/default_src/micropython/blocks/iot.js
@@ -323,6 +323,23 @@ export const iot_mixio_connect = {
};
export const IOT_MIXIO_PUBLISH = {
+ init: function () {
+ this.setColour(IOT_HUE);
+ this.appendDummyInput()
+ .appendField("MixIO")
+ this.appendValueInput('TOPIC')
+ .appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_NEW)
+ .appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_TOPIC);
+ this.appendValueInput('MSG')
+ .appendField(Blockly.Msg.HTML_BODY);
+ this.setInputsInline(true);
+ this.setPreviousStatement(true);
+ this.setNextStatement(true);
+ this.setTooltip(Blockly.Msg.MIXLY_ESP32_IOT_EMQX_PUBLISH_TOOLTIP);
+ }
+};
+
+export const IOT_MIXIO_PUBLISHEX = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
diff --git a/boards/default_src/micropython/generators/iot.js b/boards/default_src/micropython/generators/iot.js
index 94f49720..1c30b2de 100644
--- a/boards/default_src/micropython/generators/iot.js
+++ b/boards/default_src/micropython/generators/iot.js
@@ -88,6 +88,14 @@ export const iot_mixio_connect = function (_, generator) {
}
export const IOT_MIXIO_PUBLISH = function (_, generator) {
+ var topic = generator.valueToCode(this, 'TOPIC', generator.ORDER_ATOMIC);
+ var msg = generator.valueToCode(this, 'MSG', generator.ORDER_ATOMIC);
+ generator.definitions_['import_mixiot'] = "import mixiot";
+ var code = 'mqtt_client.publish(MQTT_USR_PRJ + ' + topic + ', ' + msg + ')\n';
+ return code;
+}
+
+export const IOT_MIXIO_PUBLISHEX = function (_, generator) {
var topic = generator.valueToCode(this, 'TOPIC', generator.ORDER_ATOMIC);
var msg = generator.valueToCode(this, 'MSG', generator.ORDER_ATOMIC);
var q = this.getFieldValue('quality');
diff --git a/boards/default_src/micropython_esp32/template.xml b/boards/default_src/micropython_esp32/template.xml
index 36b15f0d..d2d1c92c 100644
--- a/boards/default_src/micropython_esp32/template.xml
+++ b/boards/default_src/micropython_esp32/template.xml
@@ -2385,6 +2385,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32c2/template.xml b/boards/default_src/micropython_esp32c2/template.xml
index c3132a87..9d2a84c4 100644
--- a/boards/default_src/micropython_esp32c2/template.xml
+++ b/boards/default_src/micropython_esp32c2/template.xml
@@ -2281,6 +2281,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32c3/template.xml b/boards/default_src/micropython_esp32c3/template.xml
index 66dbd688..19f5ae97 100644
--- a/boards/default_src/micropython_esp32c3/template.xml
+++ b/boards/default_src/micropython_esp32c3/template.xml
@@ -2166,6 +2166,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32s2/template.xml b/boards/default_src/micropython_esp32s2/template.xml
index 91157fce..db2b6100 100644
--- a/boards/default_src/micropython_esp32s2/template.xml
+++ b/boards/default_src/micropython_esp32s2/template.xml
@@ -2196,6 +2196,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_esp32s3/template.xml b/boards/default_src/micropython_esp32s3/template.xml
index cb01617d..f4006f3c 100644
--- a/boards/default_src/micropython_esp32s3/template.xml
+++ b/boards/default_src/micropython_esp32s3/template.xml
@@ -2680,6 +2680,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/micropython_robot/template.xml b/boards/default_src/micropython_robot/template.xml
index 9546ea3d..89f53a59 100644
--- a/boards/default_src/micropython_robot/template.xml
+++ b/boards/default_src/micropython_robot/template.xml
@@ -2033,6 +2033,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+
diff --git a/boards/default_src/python_mixpy/template.xml b/boards/default_src/python_mixpy/template.xml
index 8797774b..79d3cfab 100644
--- a/boards/default_src/python_mixpy/template.xml
+++ b/boards/default_src/python_mixpy/template.xml
@@ -1595,6 +1595,18 @@
+
+
+
+ topic
+
+
+
+
+ msg
+
+
+