I am not sure that you are fully grasping the publish/subscribe approach.
Somewhere in the Arduino code you need to have a subscribe command.
We don't know what mqtt library you are using but the syntax might be something like
mqtt.subscribe("RESET")
This line notifies the broker which topic your code is interested in. The broker will send nothing to the Wemos without this.
But this is a Node-red forum, I'm sure you would get more help if you can find a support forum for the Arduino IDE, or there are plenty of online examples for MQTT on Arduino.
Here's the Arduino code I used to test using the remote HiveHQ broker in a very old Wemos D1 Mini device (I no longer use). You will need to adjust the settings to match your local situation.
#include <WiFi.h> // Use <ESP8266WiFi.h> for ESP8266
#include <PubSubClient.h>
const char* ssid = "Your_WiFi_SSID";
const char* password = "Your_WiFi_Password";
const char* mqtt_server = "broker.hivemq.com"; // Public MQTT broker
WiFiClient espClient;
PubSubClient client(espClient);
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("]: ");
for (unsigned int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
}
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWiFi connected");
// Setup MQTT
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
// Connect to MQTT Broker
while (!client.connected()) {
Serial.print("Connecting to MQTT...");
if (client.connect("ESPClient")) {
Serial.println("connected");
client.subscribe("test/topic"); // Subscribe to topic
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" retrying in 5 seconds...");
delay(5000);
}
}
}
void loop() {
client.loop(); // Keep MQTT connection alive
}
Notice there is a client.subscribe("test/topic"); about 12-lines from the bottom of the script.
Here's a link to one of my IoT students' project controlling some LEDs via a local MQTT broker.
Although the project is over 3-years old it should still work.
Hope it helps you get started with using MQTT as a transport medium.
Note: I think most people, on the Node-RED forum, use the Mosquitto broker rather than ADES.
I must admit, I've not used Arduino or Wemos D1 Mini devices for a few years as I switched over to using ESP32-S2-Mini (or ESP32-C3-Super-Mini) and Micro-Python for my personal projects.
During COVID I was trying to clean-up over 50 Wemos devices my IoT students had used. Some of the devices had been flashed with Arduino and some with ESPeasy, so (in a lot of cases) when I powered-them-up it was impossible to find out what was coded onto them. Micro-Python is an interperted language written in plain text that is loaded onto the microcontroller. So when it is connected to a terminal or PC you can "see" (and edit) the code inside it. So easy to maintain.
The ESP32-S2-Mini is built using a newer technology with higher performance, much faster than the Wemos and offers a lot more functionality. Although it has twice as many pins as the Wemos, it is pin-compatible on the outer column of pins, so can be used as a drop-in replacement.
I intend to explain my rationale in more detail as a write-up on 'Share Your Projects' (soon).