Smartthings MQTT Bridge

Installed the SmartThing app, bit I didn’t find MQTT_BRIDGE_APP in the “automatico - smartapp” section… Where I’m wrong?

I have everything set up on the ST side and it is communicating updates to my SmartThings-Mqqt bridge Add-on for HASSIO. I have the following config for my the Smartthings MQTT Bridge"

{
  "broker_host": "192.168.1.74",
  "broker_port": 1883,
  "preface": "smartthings",
  "state_suffix": "state",
  "command_suffix": "cmd",
  "login": "",
  "password": "",
  "bridge_port": 2080
}

and using the Mosquitto MQTT Broker addon with the following settings:

{
  "plain": true,
  "plain_websockets": false,
  "ssl": false,
  "ssl_websockets": false,
  "anonymous": true,
  "logins": [],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

My smartthings bridge shows the following in its log:

nfo: Saving current state
info: Saving current state
info: Subscribing to smartthings/Contacts/notify/cmd, smartthings/System/notify/cmd, smartthings/Front Door/battery/cmd, smartthings/Garage Door/battery/cmd, smartthings/Front Door/lock/cmd, smartthings/Garage Door/lock/cmd, smartthings/Clint's S8+/presence/cmd
info: Saving current state
info: Incoming message from SmartThings: smartthings/Garage Door/lock/state = unlocked
info: Saving current state

which indicates it is updating from the hub. But my Mosquitto log shows:

1532011746: mosquitto version 1.4.15 (build date 2018-03-04 15:14:46+0000) starting
1532011746: Config loaded from /etc/mosquitto.conf.
1532011746: Opening ipv4 listen socket on port 1883.
1532011746: Opening ipv6 listen socket on port 1883.
1532011746: Warning: Mosquitto should not be run as root/administrator.
1532011746: New connection from 192.168.1.74 on port 1883.
1532011746: New client connected from 192.168.1.74 as mqttjs_664798b7 (c1, k10).
1532011756: New connection from 192.168.1.74 on port 1883.
1532011757: Socket error on client <unknown>, disconnecting.
1532011757: New connection from 192.168.1.74 on port 1883.
1532011757: New client connected from 192.168.1.74 as d6bd8c15-4de7-4c2a-8ba1-f4cf08f9df59 (c1, k60).
1532012494: Socket error on client mqttjs_664798b7, disconnecting.
1532012495: New connection from 192.168.1.74 on port 1883.
1532012495: New client connected from 192.168.1.74 as mqttjs_664798b7 (c1, k10).
1532013547: Saving in-memory database to /data/mosquitto.db.
1532015348: Saving in-memory database to /data/mosquitto.db.
1532017149: Saving in-memory database to /data/mosquitto.db.
1532018950: Saving in-memory database to /data/mosquitto.db.
1532020751: Saving in-memory database to /data/mosquitto.db.
1532022552: Saving in-memory database to /data/mosquitto.db.
1532024353: Saving in-memory database to /data/mosquitto.db.
1532026154: Saving in-memory database to /data/mosquitto.db.
1532027955: Saving in-memory database to /data/mosquitto.db.
1532029756: Saving in-memory database to /data/mosquitto.db.
1532031557: Saving in-memory database to /data/mosquitto.db.

indicating that it is receiving connections, probably from homeassistant and from my smartthings bridge, but not updating from the smartthings bridge. The unknown device disconnect may have something to do with it. I configured my homeassistant config.yaml as such:

mqtt:
  broker: 192.168.1.74
  port: 1883
  discovery: true
  discovery_prefix: smartthings
  
  - platform: mqtt
    name: Garage Door
    state_topic: "smartthings/Garage Door/lock/"
    command_topic: "smartthings/Garage Door/lock/"
    payload_lock: "LOCK"
    payload_unlock: "UNLOCK"
    optimistic: false
    retain: true

With these settings my lock shows up in the UI, but it always shows as unlocked. If I click the LOCK button it will change state in the UI and present me an UNLOCK button, which I can press to change back, but it never transmits the signal to the MQTT broker. Somewhere there is a disconnect, probably mainly between MQTT and the smartthings bridge, but I can’t find it for the life of me.

Edit: my setup is an Ubuntu 16.04 VM with HASSIO installed. The Ubuntu VM is running on Bhyve Hypervisor on a FreeNAS 11.4 installation. All IP addresses are DHCP reservations in my router so that there is no mistake in entering the proper network info, but they always keep the correct IPs.

You said you followed the steps on GitHub - stjohnjohnson/smartthings-mqtt-bridge: Bridge between SmartThings and MQTT
but step 5 says

  • Install the Smart App on the Smart App IDE using “Create via code”

and step 6 says

  • Configure the Smart App (via the Native App) with the devices you want to share and the Device Handler you just installed as the bridge

SmartThings has two apps. The new Samsung app and the older SmartThings App.
In iOS app store they are named SmartThings Classic (old version) and SmartThings (Samsung Connect) which is the new version. The new version is JUNK and I recommend avoiding it. This is one of the main reasons I am moving my devices over to HA from SmartThings.

You have to install the MQTT_BRIDGE_APP using the ide (ide.smartthings.com) and you then need to open the app in the SmartThings Classic (Not sure if it is named same on android) and configure it.

@smart, thanks for your time! the problem was that I must “publish” the app in the IDE, the “save” button is not sufficient.

1 Like

Hi there,

I am trying to pass on a “string” from home assistant to a custom device in smarthings
Im thinking of using the mqtt publish but for the love of god i cant figure out how to do it

Can anyone help me??? (trying to pass the string to value1)

Does this help?
https://community.home-assistant.io/t/use-mqtt-service/40483/6

My homeassistant now updates with the current state of the lock, but for the life of me I can’t get homeassistant to publish to the smartthings bridge and subsequently control the devices, when I click the button on the front end to lock/unlock, nothing happens. I am sure this has to do with my MAC address setting in the IDE, but what MAC do I use. As posted above, my setup is as follows: Primary host is FreeNAS 11.1-U5, then in a Bhyve VM I have Ubuntu 16.04. Hassio is installed on Ubuntu which then creates everything in dockers. Aside from the FreeNAS system, all other devices are virtual NICs with generated MAC addresses. In my router I see MAC addresses for FreeNAS and for Ubuntu. I used the mac address shown in my router for the Ubuntu installation, but it doesn’t work. If I use Putty to terminal into my Ubuntu and run ifconfig, I get:

docker0   Link encap:Ethernet  HWaddr 02:42:f7:5d:87:d8
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr: fe80::42:f7ff:fe5d:87d8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10184 errors:0 dropped:0 overruns:0 frame:0
          TX packets:85261 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1023830 (1.0 MB)  TX bytes:21636991 (21.6 MB)

enp0s3    Link encap:Ethernet  HWaddr 00:a0:98:4d:16:c8
          inet addr:192.168.1.74  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2a0:98ff:fe4d:16c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:51084393 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5664680 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:58564083432 (58.5 GB)  TX bytes:1860158144 (1.8 GB)

hassio    Link encap:Ethernet  HWaddr 02:42:a5:2c:c0:14
          inet addr:172.30.32.1  Bcast:172.30.33.255  Mask:255.255.254.0
          inet6 addr: fe80::42:a5ff:fe2c:c014/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:219800 errors:0 dropped:0 overruns:0 frame:0
          TX packets:458209 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:35371573 (35.3 MB)  TX bytes:44521012 (44.5 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:422298 errors:0 dropped:0 overruns:0 frame:0
          TX packets:422298 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:241654874 (241.6 MB)  TX bytes:241654874 (241.6 MB)

veth3b3f0fe Link encap:Ethernet  HWaddr 02:f8:78:a7:7a:7e
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:163182 errors:0 dropped:0 overruns:0 frame:0
          TX packets:398836 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11125368 (11.1 MB)  TX bytes:39372099 (39.3 MB)

vetha6c2122 Link encap:Ethernet  HWaddr 12:e9:4b:19:83:0b
          inet6 addr: fe80::10e9:4bff:fe19:830b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6223 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15537 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1789889 (1.7 MB)  TX bytes:2731248 (2.7 MB)

vethf2de832 Link encap:Ethernet  HWaddr c2:6c:62:57:9e:60
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1073 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10379 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

As you can see the enp0s3 appears to be my virtual NIC that connects to my router, but I even tried the docker and hassio MAC addresses to no avail. I even used the physical MAC associated with the FreeNAS host system, but still didn’t work.

Any Ideas? I’m pulling out my hair here.

Hi,

I had the same problem i fixed by chaning the mac from (a1:bd:22:33:bs) to (A1BD2233BS)

Thanks for the reply, unfortunately I already have it set that way. Upon much deeper investigation assisted by a random error that never came up before, I think I have determined the root cause of my troubles. Apparently this setup works with the Smartthings Hub v1/v2, but does not work any longer with the Shield TV Smartthings Link. It seems a recent update broke the ability for the Link to receive commands from the broker. The update was on the Shield TV and happened shortly before I bought one. Had I known, I would have just bought a wink hub for the local control, but $20 for a hub (Link) seemed a lot better. Oh well. Status for now, I’ll look at control later.

I can also confirm that the Shield TV update closed the port needed by the Smartthings MQTT bridge and thus it no longer works.

I used that as an opportunity to migrate everything over to a dedicated pi connected with a husbzb-1 talking to my main virtual machine running hass.io via MQTT eventstream.

Hi…

I just wanted to add my appreciation for this thread as it could help resolve my issue in getting the HA-Smartthings MQTT bridge working. Struggled for few days after doing all that was described in various postings but the final issue was HA not getting any mqtt posting from Smartthings.

I found out by the info. in this posting that my problem was I had the config.yml file in 3 places as a result of trying pm2 and supervisor, etc. Finally I figured out which one is being used by pm2 and updated the file, then everything started getting reported in HA.

Could someone please help me out with this?
I have Smartthings MQTT Bridge setup and working with HA. I have 6 First Alert Smoke/CO Combo Zwave detectors in Smartthings and added them in the smartthings mqtt app. It gave me options for Battert/Smoke/CarbonMonoxide.

In Smartthings IDE logs I can see the topics being posted like…

In HA SmartThingsBridge Logs I can see…

In my configuration I have

  • platform: mqtt
    name: “First Alert Kitchen”
    state_topic: “smartthings/First Alert Kitchen/smoke sensor/contact/state”
    payload_on: “detected” #This is case sensitive!
    payload_off: “clear” #This is case sensitive!
    retain: true #this is important so HA doesn’t report the sensor as disconnected

How to I get the 3 different states that I see in the logs? Battery/Smoke/CO. I have tried and tried to get this buy I cant seem to figure it out.

Thanks

Hi,

Please can someone help, I have had all this working for about 8 months or so, but it all just stopped yesterday without me having changed anything, here is what i am seeing:

STBridge

starting version 3.2.2
info: Starting SmartThings MQTT Bridge - v1.3.4
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
info: Saving current state
info: Connecting to MQTT at mqtt://172.17.0.1:1883
events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Connection refused: Not authorized
    at MqttClient._handleConnack (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/mqtt/lib/client.js:735:9)
    at MqttClient._handlePacket (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/mqtt/lib/client.js:296:12)
    at process (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/mqtt/lib/client.js:238:12)
    at Writable.writable._write (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/mqtt/lib/client.js:248:5)
    at doWrite (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at Writable.write (/usr/lib/node_modules/smartthings-mqtt-bridge/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at Socket.ondata (_stream_readable.js:555:20)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)

Mosquitto broker:

1541698808: New connection from 172.30.32.1 on port 1883. [ERROR] Auth error with login 1541698810: Socket error on client &lt;unknown&gt;, disconnecting. 1541699061: Client a3bb2d8b-92e4-4cf9-a938-a588a12d4d68 disconnected. 1541699089: New connection from 172.30.32.1 on port 1883. 1541699089: New client connected from 172.30.32.1 as a03b6f50-4851-4099-8d5c-5f70bcd2de94 (c1, k60). 1541699195: New connection from 172.30.32.1 on port 1883. [ERROR] Auth error with login 1541699196: Socket error on client &lt;unknown&gt;, disconnecting.

As mentioned I have not been in or changed anything to do with mqtt or ST.

Please help

I had same with my zigbee2mqtt. Same error message.

Lots of people had issues with MQTT this weeks after an update to v3 of addon.

I had to restart from scratch as my SD got in a right state!

To get around that issue I had to create a MQTT user to connect with in Mosquitto as the anonymous was set to False.

I still have to re-add Smartthings addon, so will no doubt have same issue. But I will again be using a user created as mentioned previously

I’m affected, but I couldn’t get authorization to work. Even a user that OwnTracks uses with my mosquitto broker successfully was refused.

Im thinking of ditching Smartthings altogether as I use zigbee2mqtt and Xiaomi sensors, the Samsung hub was what I bought before I got into HomeAssistant. There is nothing on it that I haven’t done with Xiaomi now… could be time for Ebay I think and no more half measures of 1yr old addons with no updates

Turned out my /opt/mqtt-bridge/config.yml was formatted incorrectly with tabs instead of spaces.

1 Like

There was an update on the Plugin… it changed something in the authorization. This works for me:

{
  "logins": [],
  "anonymous": true,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}
2 Likes

I’m getting the following error log in Mosquitto broker. Anyone have any ideas why? Smartthings bridge appears to be working correctly, but the actions are not being picked up by MQTT:

This is driving me nuts. It simply wont work. Anyone have any idea why?
The MQTT Broker log shows this:

[INFO] Setup mosquitto configuration
[WARN] SSL not enabled - No valid certs found!
[INFO] No local user available
[INFO] Initialize system configuration.
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
Error: Unable to open include_dir ‘/share/mosquitto’.
Error found at /etc/mosquitto.conf:27.
Error: Unable to open configuration file.