Thank you for your quick answers.
I will try with this new information
exblematique
@exblematique
Best posts made by exblematique
-
RE: Problem with Mosquitto Topic
-
RE: Problem with Mosquitto Topic
Thank you for your all answers.
I have made some tests and even if I don't have results for the moment, the best solution for me seems using (in accordance with @bgunnarb):MY_MQTT_PUBLISH_TOPIC_PREFIX ESP-topic/ESP-number
Yes, it's can be a good idea @mfalkvidd
Latest posts made by exblematique
-
RE: Problem with Mosquitto Topic
Thank you for your all answers.
I have made some tests and even if I don't have results for the moment, the best solution for me seems using (in accordance with @bgunnarb):MY_MQTT_PUBLISH_TOPIC_PREFIX ESP-topic/ESP-number
Yes, it's can be a good idea @mfalkvidd
-
RE: Problem with Mosquitto Topic
Thank you for your quick answers.
I will try with this new information -
Problem with Mosquitto Topic
Hi everyone,
I need to change serial communication for a Mosquitto on an existing project. There is one PC and 3 ESP32 without radio-frequency To put be simply, there is a PC which controls ESP32 by the network. On the current project, the node ID is the number of ESP between 1 and 3.
However, when a try to set up the MQTT gateway, the first topic is always 0. If I'm used message.setDestination(1), this message is not sending (return 0).
I'm using this following code to my ESP32:
#define MY_DEBUG #define MY_NODE_ID 2 /********************************************** * Ethernet Gateway Transport Defaults */ #define MY_GATEWAY_MQTT_CLIENT #define MY_GATEWAY_ESP32 /** Configuration of WiFi */ #define MY_WIFI_SSID "Test" #define MY_WIFI_PASSWORD "qwerty1234" #define MY_HOSTNAME "Boss2" /** MQTT Configuration **/ #define MY_MQTT_PUBLISH_TOPIC_PREFIX "sendToPc" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "getToPc" #define MY_MQTT_CLIENT_ID "Boss2" #define MY_CONTROLLER_IP_ADDRESS 192, 168, 56, 101 #define MY_PORT 1883 /**********************************************/ #include <MySensors.h> #define MY_BAUD_RATE 115200 #define OPEN 1 #define CLOSE 0 #define CHILD_ID 1 MyMessage msg; uint8_t value = OPEN; void presentation() { present(CHILD_ID, S_DOOR); } void setup(){ Serial.begin(115200); msg.setType(V_TRIPPED); msg.setSensor(CHILD_ID); } void loop() { value = value == OPEN ? CLOSE : OPEN; send(msg.set(value)); delay(1000); }
And on serial terminal I have :
20182 GWT:TPC:CONNECTING... 20684 GWT:TPC:CONNECTING... 20686 GWT:TPC:IP=192.168.137.160 20691 MCO:BGN:STP(20693 MCO:REG:NOT NEEDED 20695 MCO:BGN:INIT OK,TSP=NA 20697 GWT:TPC:IP=192.168.137.160 20700 GWT:RMQ:MQTT RECONNECT 20723 GWT:RMQ:MQTT CONNECTED 20725 GWT:TPS:TOPIC=sendToPc/0/255/0/0/17,MSG SENT 20733 GWT:TPS:TOPIC=sendToPc/0/1/0/0/0,MSG SENT 20740 GWT:TPS:TOPIC=sendToPc/0/1/1/0/16,MSG SENT 21745 GWT:TPS:TOPIC=sendToPc/0/1/1/0/16,MSG SENT 22751 GWT:TPS:TOPIC=sendToPc/0/1/1/0/16,MSG SENT
Rather than
20740 GWT:TPS:TOPIC=sendToPc/2/1/1/0/16,MSG SENT
Do you have a solution?
Thank you