https://diyi0t.com/microcontroller-to-raspberry-pi-wifi-mqtt-communication/
I used the way that article set the broker on Raspberry but strange thing happen
According to article , I need to use
sudo systemctl start mosquitto
to start connection then can use
sudo systemctl status mosquitto
and yes the status is active , BUT actually can't use if i use the command to check
mosquitto
it shows Error : Address already in use
(Remember , my esp32 device actually fail to connection in this time)
And if I manually close broker
sudo systemctl stop mosquitto
then check status , really in inactive
sudo systemctl status mosquitto
Now if I use command
mosquitto
the esp32 device can connect successfully now (I have another python script using mqtt to get data)
I bet the problem is on sudo systemctl start mosquitto & mosquitto
permission problem but not sure how to solve
(or maybe other problem)
----20201103 update ---- log file after sudo systemctl start mosquitto and then mosquitto
config loaded from /etc/mosquitto/mosquitto.conf.
Opening ipv4 listen socket on port 1883.
Error : Address already in use
So currently , the way I can connect esp32 device with raspberry by mqtt is using command
mosquitto
But not use
sudo systemctl start mosquitto
----20201104 update ---- I'll Reply you all here, maybe I didn't explain it clear:
Situation One
Running sudo systemctl start mosquitto
and then mosquitto
It's because sudo systemctl start mosquitto
can't make connection work
And I use mosquitto
to check what happen
Situation Two
Running sudo systemctl stop mosquitto
and then mosquitt
I use sudo systemctl stop mosquitto
to stop broker first then use mosquitto
and the connection work
But it shouldn't be like this the right way is use sudo systemctl start mosquitto
only
situation1 is totally wrong
situation2 although it can work but not the right way to do