WeMos D1 mini w/espeasy but no MQTT

So is it working now ???

I get about 1 in 10 connection failures but that one gets out, I think. Where it goes I don't know. Still working on it. :frowning:

Did you try the very simple Node-Red flow??

That flow just uses MQTT (mosquitto??) running on your Raspberry Pi.
When you click the "inject" node you should immediately get a response in the "debug" node.

I had connection failures with one of my Wemos nodes a month or so ago. The problem was very low WiFi signal strength on that particular node.
You can see/check the WiFi RSSI by logging in to the Wemos and going to the "Main" tab.

I did a fresh install of Raspbain stretch with all updates.
I installed mosquitto: sudo apt-get install mosquitto mosquitto-clients

I installed mosquitto on my Linux Mint 18.3 desktop, same commands.

I opened a terminal on the RPi3 (vnc) and sent the command:
mosquitto_sub -t node141/#

I opened a terminal in Linux and sent the command:
mosquitto_pub -h 192.168.1.140 -p 1883 -t node141/DHT22/temperature -m "12.32"

In the RPi3 terminal I received this data:
12.32

I changed the subscribe topic to node141/DHT22/temperature/#
In the RPi3 terminal: 12.32

I think the obvious villain is the WeMos D1 mini or espeasy.
I can ping the WeMos from my windows laptop or Linux desktop and both return ok.

Dang! This isn't supposed to be this hard!

Is it still connecting and disconnecting as shown in the mosquitto log?

!!!!!!!!!!!!!!!!!!!!!!!! It's working !!!!!!!!!!!!!!!
Wahooooo!
I removed the "/" from in front of the %sysname% and it is connecting with NO errors.

Those pesky slashes!

they're like ants, worse, piss-ants. You don't see them until they bite you. :sunny:

1 Like

Really pleased to hear you've got it working.
As I said in a previous email - one day when it's raining and I'm bored I'm going to go through and remove the "/" from the publish and subscribe text string on my Wemos units.

Now you can start playing and enjoying the Wemos D1s.

Oh, a lot of work for the sign /:wink:

I did a little research.
The default settings for OpenHAB MQTT (Contollers-> Protocol) are:

  • Controller Subscribe:/%sysname%/#
  • Publish Controller:/%sysname%/%tskname%/%valname%
    So the first sign is /

In the node-RED you also need to set the first sign to / in "mqtt in".
After this sign we have %sysname%, which is Unit name from Config-> Main settings->.

After this, we have two ways:

  • we can use /%sysname%/%tskname%/%valname% (%tskname%/%valname% are from Device tab)
  • or we can use the Rules

When we use the Rules, we create the Publish template as we wish.

Here are the image settings (original WEMOS D1 mini Pro, old version), EspEasy mega-20180802, one relay on (GPIO14-D5), one DS18B20 on (GPIO4-D2) and node-RED flow.

[{"id":"129c538c.28dd1c","type":"mqtt in","z":"9e65bdcf.4a232","name":"","topic":"/ESP_8266_1/DS18B20_1/Temperature_1/#","qos":"2","broker":"a71cb48.78a0248","x":190,"y":80,"wires":[["bb9d0417.fa60d8","1b333d40.5b7ef3"]]},{"id":"987c9761.44e778","type":"mqtt in","z":"9e65bdcf.4a232","name":"","topic":"/ESP_8266_1/out_1/#","qos":"2","broker":"a71cb48.78a0248","x":120,"y":180,"wires":[["b59d385c.74fe08","ceadcbd4.09ee48"]]},{"id":"b59d385c.74fe08","type":"switch","z":"9e65bdcf.4a232","name":"ON/OFF","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":100,"y":300,"wires":[["b4e1f90b.a8ad28"],["f21d4d72.055c9"]]},{"id":"aa889758.2c0f38","type":"ui_switch","z":"9e65bdcf.4a232","name":"","label":"Pumpa","group":"fcf70780.a79938","order":1,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":400,"y":300,"wires":[["840b03d1.64f5b","a92f58c4.8526d8"]]},{"id":"840b03d1.64f5b","type":"debug","z":"9e65bdcf.4a232","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":550,"y":260,"wires":[]},{"id":"b4e1f90b.a8ad28","type":"change","z":"9e65bdcf.4a232","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":280,"wires":[["aa889758.2c0f38"]]},{"id":"f21d4d72.055c9","type":"change","z":"9e65bdcf.4a232","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":320,"wires":[["aa889758.2c0f38"]]},{"id":"ceadcbd4.09ee48","type":"debug","z":"9e65bdcf.4a232","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":470,"y":180,"wires":[]},{"id":"53febc7e.e3b774","type":"http request","z":"9e65bdcf.4a232","name":"HTTP GET On","method":"GET","ret":"txt","url":"192.168.1.38/control?cmd=GPIO,14,1","tls":"","x":740,"y":280,"wires":[[]]},{"id":"a92f58c4.8526d8","type":"switch","z":"9e65bdcf.4a232","name":"Switch On or Off","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":300,"wires":[["53febc7e.e3b774"],["49bf348a.a5d46c"]]},{"id":"49bf348a.a5d46c","type":"http request","z":"9e65bdcf.4a232","name":"HTTP GET Off","method":"GET","ret":"txt","url":"192.168.1.38/control?cmd=GPIO,14,0","tls":"","x":740,"y":320,"wires":[[]]},{"id":"8281d62e.95dd58","type":"ui_button","z":"9e65bdcf.4a232","name":"","group":"fcf70780.a79938","order":2,"width":"3","height":"1","passthru":false,"label":"Timer","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":390,"y":420,"wires":[["73b98385.cff65c"]]},{"id":"73b98385.cff65c","type":"http request","z":"9e65bdcf.4a232","name":"HTTP GET On","method":"GET","ret":"txt","url":"192.168.1.38/control?cmd=LongPulse,14,1,5","tls":"","x":560,"y":420,"wires":[[]]},{"id":"bb9d0417.fa60d8","type":"debug","z":"9e65bdcf.4a232","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":470,"y":60,"wires":[]},{"id":"1b333d40.5b7ef3","type":"ui_gauge","z":"9e65bdcf.4a232","name":"","group":"fcf70780.a79938","order":0,"width":0,"height":0,"gtype":"gage","title":"Outside temperature","label":"°C","format":"{{value | number:1}}","min":"-20","max":"60","colors":["#004080","#00ff00","#ff0000"],"seg1":"10","seg2":"25","x":520,"y":100,"wires":[]},{"id":"a71cb48.78a0248","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.25","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"fcf70780.a79938","type":"ui_group","z":"","name":"Default","tab":"92218829.a70ba8","disp":true,"width":"6","collapse":false},{"id":"92218829.a70ba8","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Thanks for the input markost.
I did format the node topic with the leading "/" but it didn't help until I wiped the SD and started over from scratch. I think the biggest change I made was installing everything from the repository. Secondarily, I knew a little more of what I was doing and made no mistakes while installing.
My trouble shooting method was more sophisticated the second time around. I found the documents for mosquitto and was able to test the broker more thoroughly. Knowing how to subscribe to all messages was a huge help. I spent practically no time watching a debug window, waiting for something to happen.
You did do some research! I'm going to have to spend some time absorbing the information. It's very thorough and well organized and much appreciated. :slight_smile:

1 Like