[RELEASE] New MQTT Bridge with Tasmota Sonoff Wifi and RF Integrations and other custom MQTT

I should have read the code before I asked! but you did help.
So… switched the log level to debug, but didnt get any extra info, despite debug logging in the code. (did put in an winston.info to check the log level in config was being picked up and it was (which I guessed because the IP of mosquitto is being identified!)
gets to line 590 of the code and then does nothing! No further info (or debug) logging. Just stops afer 'Connecting to MQTT at"
I’ll have a play after reading through the code, but my problem seems to be that I am not connecting to mosquitto from the bridge side, even though the Tasmota side is happily connecting with the right details.
I’m 80% sure it is something I’ve done wrong in the config, I just cant see what!

Most likely because Im running on a VM and the network is being funny, though I have checked (and tripple checked) the settings.


Sorry for not getting back earlier - not getting notified from the messages here so didnt know you had replied. Maybe better if we can troubleshoot this on github issues since that notification always works and maybe others can benefit too.

Actually I take it back (ignore for now the section below the =====)
your log file should read something like

2019-11-05 04:17:10 AM info: Connecting to MQTT at mqtt://
2019-11-05 04:17:11 AM info: Subscribing to - [bunch of topics if you have any]
2019-11-05 04:17:11 AM info: Configuring autosave
2019-11-05 04:17:11 AM info: Configuring API
2019-11-05 04:17:11 AM info: Listening at http://localhost:8080

if you are not getting to subscribing or the configuring autosave lines it implies the mbs-server is not able to connect to you MQTT broker. Try troubleshooting as follows
Check the error%date%.log - if mtt.connect is throwing an exception it should be captured there (any other exception too).
that will point you in the right direction - it definitely appears to be a problem with connecting to the MQTT broker

  1. Are you running the broker and the mbs-server on the same IP address in the same VM?
  2. is the node js mqtt library installed and in node path? did you install the package with NPM or jsut copied the files over?
  3. Can you ping/telnet to this IP port?

If you get to Listening at http://localhost:8080 . That last commands means it is waiting and listening.

That would mean your mbs-bridge device is not connecting to the server and neither is the mbs-smartapp.

Please confirm

  1. the bridge has been configured with the IP of port 1883 (where the broker is running) and the MAC address of the machine / VM running the mbs-server (not the mqtt broker if they are running on different machines)
  2. In the smartapp besides checking the devices make sure you have also selected the bridge that you created. That configuration is much lower after the devices so you could miss it

also make sure your firewall is not blocking the mbs-server app from receiving requests on port 1883. At least in windows when I run the server firewall dialogue box comes up request access.

are you seeing any debug messages from the bridge in smartthhings IDE logging?

thanks for this… going through your suggestions now.
I’ve added some extra logging and noticed a few things relating to the indentation of the device.yml, but that’s a separate conversation!

to your point

if you are not getting to subscribing or the configuring autosave lines it implies the mbs-server is not able to connect to you MQTT broker.

yep that’s the problem! just got to work out why!

I’ll also be upfront now on something that shouldnt make any difference, but I am running the server and mosquitto on ubuntu in a virtual machine I have spare! I am obviously going to be fully documenting the process once it is working, but this will also lead to people maybe using a RPi as the MQTT bridge and broker. Have to admit, most instructions are the same as you provided! And as I said Mosquitto is working fine, and the smartthings MQTT bridge installed fine and does run! just appears a connection and setup thing… just cant see what it is though!

Im now moving over to Github to continue the conversation.
BTW… I’ll also be able to test on shelly 1, shelly 4pro, touch EU, touch 3, ifan03 and a few other devices which might be easier with MQTT rather than specific drivers.

Running on pi should not be an issue - i also ran it on an old pi but was not using VM. just running it as a pi service.

if both the server and broker are running in the same VM then not sure why they are connecting. did you check the error log ? maybe it is not finding the nodejs MQTT package, maybe the nodejs path cannot reach MQTT.

did you do npm -g install for the mbs package or just copied the files. don’t think i see a pull from NPM. if you just copied the files make sure mqtt and any other dependencies have the right vesion and are in the node path.

Just in case people were reading the chain and getting confused… we have got the bridge working on Ubuntu which means people can use it with a RPi or a windows box (or like me in a VM running unbuntu)
Just testing with a bunch of different devices including sonoff switches with tasmota, shelly switches with tasmota, shelly pro 4 (shelly code) - this means it would then be possible to use any shelly device without flashing!, and the sonoff iFan03. Will update when we have more news over next few days.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.