• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

“Build a Home Automation System_esp32_Attempting MQTT connection…failed

Q&A Forum › “Build a Home Automation System_esp32_Attempting MQTT connection…failed
0 Vote Up Vote Down
Torres asked 6 months ago

I have the following data:
 
#define MQTT_HOST IPAddress(169,254,97,145) //MQTT BROKER IP ADDRESS
#define MQTT_PORT 1883
#define BROKER_USER “paulo”
#define BROKER_PASS “abc12345”

 
In terminal I have:
pi@raspberrypi:~ $ hostname -I
169.254.97.145 192.168.1.204
 
In terminal I use:
mosquitto_pub -u esp32 -P myesp32 -t testTopic -m “Hello world!”
 
mosquitto_sub -u paulo -P abc12345 -v -t testTopic
 
What is my mistake?

2 Answers
0 Vote Up Vote Down
Torres answered 6 months ago

#define MQTT_HOST IPAddress(192,168,1,204) //MQTT BROKER IP ADDRESS
This must work with wifi: inet 192.168.1.204
 

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.204 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a432:26b2:c6b:585c prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:4b:7f:34 txqueuelen 1000 (Ethernet)
RX packets 117668 bytes 9471518 (9.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7659 bytes 3813901 (3.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
 
I’m sorry, but can you provide more details about your issue?
What errors messages do you get on the serial monitor?
Why are you using two different MQTT users ?
 
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.