Hi,
Would it be possible to provide advice on configuring port setting that is different form the default port 1833 and what code changes need on the two project files.
Also, if it possible, adding password to the for the Raspberry Pin broker and code changes for the two ESP32 MQTT project files.
Thanks
Hi.
To add password and user to the Mosquitto MQTT broker, you need to follow this tutorial: https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
To change port on the ESP32 code, change on the following line:
#define MQTT_PORT 1883
You can insert the MQTT username and password on the ESP32 code after the following line:
mqttClient.setServer(MQTT_HOST, MQTT_PORT);
Add:
mqttClient.setCredentials("REPlACE_WITH_YOUR_USER", "REPLACE_WITH_YOUR_PASSWORD");
Let me know if this helps.
Regards,
Sara
Hi Sara,
While awaiting your reply, I stumble upon the solution as you have advised. It worked.
At the Raspberry Pi, MQTT server end, the port, user and password has to be configured to match that set in here
Thanks for your advice.