I have a Wemos D1 mini with a DHT22 shield all setup with espeasy and I'm reading temperature/humidy in the wemos but can't get it to connect with my mosquitto broker. I have an MQTT node working in node-red and mosquitto debug indicates it's connected.
I am at a loss as to why the WeMos D1 won't connect.
Port 1889? is it right? Generally it is 1883.
- as @cflurin said port is 1883 unless you have MQTT set for another port
- espeasy has a slash at the controller subscribe and publish - delete them to be consistant with the way everything else uses MQTT
- make sure tthat you have checked off the Enabled box
MQTT broker is installed l on Raspberry, Windows,...?
Mosquitto is installed on a Raspberry Pi3.
I've reset the port to 1883 and have tested it in node-red. My "hello world" publish and client are working fine in a node-red flow so I know Mosquitto is working. The issue is with the WeMos D1 mini, I'm sure.
I did change the port to 1889 just to see what would change. I've reset it to 1883.
The enable box is checked.
The "/controller/subscribe/publish" thing is a mystery to me. I think it should be "/irrigation_141/DHT22/TempDHT" but since I've not been able to get it to work I'm in the dark.
Is there a way to query Mosquitto as to who's connected?
I am on Windows where firewall blocking port 1883 (default) .
Same situation as yours, when pub/sub on notebook everything is ok, but from wemos not working (of course wemos and notebook are on same lan).
After change firewall rules, wemos mqtt messages are OK.
Can you see what is on wemos serial? Mqtt connect or not?
This is what the setup looks like on my mqtt controller in ESPeasy.
I use the OpenHab protocol as that option seems to work fine with Mosquitto in NR.
I haven't bothered to remove the leading "slash" (like Paul suggested).
When I've got nothing to do on a rainy day, I'll go through all 30-odd Wemos units and remove the slash.
On your Rpi in a console type:
sudo lsof -i TCP:1883
Not sure how to do that.
lsof command not found. I'm using Raspbain Stretch.
Except for the ip address I have the same setup.
I'm wondering what Controller lwl topic is.
Where do I locate sysname, tskname and valname? I think I have them but since it's not working I'm not sure.
first try:
sudo netstat | grep :1883
or install lsof:
sudo apt-get install lsof
The mosquitto broker (192.168.1.140) is there on port 1883 but no sign of WeMos (192.168.1.141).
That's crazy since I can login to espeasy and set parameters.
Ok, so you know mosquitto is running on port 1883
!
Here are some screenshots of MQTT in Node-RED that might help getting the settings correct.
I installed lsof:
pi@raspberrypi:~ $ sudo lsof -i TCP:1883
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node-red 296 pi 12u IPv4 13164 0t0 TCP raspberrypi.sugarloaf.local:45334->raspberrypi.sugarloaf.local:1883 (ESTABLISHED)
mosquitto 415 mosquitto 4u IPv4 12568 0t0 TCP *:1883 (LISTEN)
mosquitto 415 mosquitto 5u IPv6 12569 0t0 TCP *:1883 (LISTEN)
mosquitto 415 mosquitto 7u IPv4 13165 0t0 TCP raspberrypi.sugarloaf.local:1883->raspberrypi.sugarloaf.local:45334 (ESTABLISHED)
ok, so you should check your mqtt setting on the espeasy again:
sudo netstat | grep :1883
should list the wemos ip
You could also try stopping Node-RED from a terminal window.
node-red-stop
And then restart it with... node-red-start
On my system it shows when a connection is made to the MQTT broker.
Still not there. I only get the mosquitto broker ip.