Smartthings MQTT Bridge

@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 <unknown>, 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 <unknown>, 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.

What is the correct way to setup a dimmer? If I select them as “switch level” in the ST smartapp, they do not work. They won’t turn on/off and it is not updating the state of the switch. If select them as “switch” the also do not work. This is how I had them set up in the yaml files…

switch.yaml

- platform: mqtt
      name: OFC Lights
      state_topic: "smartthings/OFC Lights/switch/state,"
      command_topic: "smartthings/OFC Lights/switch/cmd,"
      payload_on: "on"
      payload_off: "off"
      retain: false

lights.yaml

- platform: mqtt
      name: "Office Lights"
      state_topic: "smartthings/OFC Lights/level/state"
      command_topic: "smartthings/OFC Lights/level/cmd"
      brightness_state_topic: "smartthings/OFC Lights/level"
      brightness_command_topic: "smartthings/OFC Lights/level/set"
      brightness_scale: 100
      payload_on: "on"
      payload_off: "off"
      retain: false

you dont need MQTT bridge anymore. Smartthings has been integrated into HA.

“integrated into HA” is a work in progress. Many but not all components are currently represented and there’s an important architectural difference. The SmartThings integration requires your Home Assistant server to be accessible from the internet whereas the MQTT bridge does not. Conversely, the MQTT Bridge requires an MQTT Broker whereas the SmartThings integration does not.