Smarter SmartThings with MQTT and Home Assistant

Still cloud-based either way, since the SmartThings hub has to talk to the cloud ultimately to turn devices on and off. But a lot easier to set up than MQTT integration if you do have a SmartThings hub, at least.

Instructions from Github:

I did get this all sorted, but my issue seemed to be with the container not able to communicate with mqtt and then smartthings not communicating with the working bridge. I never received a connection refused error. What finally got smartthings able to communicate with the bridge was removing and again adding the smartapp on my phone. Note that I’m not a Home Assistant user, which is why I needed to specify a different port.

Thanks very much for the info.

It is in a docker container, here is my docker-compose

version: ‘3’
container_name: hass
image: homeassistant/home-assistant
- /home/bsharpe/volumes/hass:/config
- /etc/localtime:/etc/localtime:ro
restart: always
- mqtt
- “8123:8123”

container_name: MQTT
restart: unless-stopped
image: eclipse-mosquitto
privileged: true
- /home/bsharpe/volumes/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
- /home/bsharpe/volumes/mosquitto/log:/mosquitto/log
- /home/bsharpe/volumes/mosquitto/data:/mosquitto/data
- /etc/localtime:/etc/localtime:ro
- “1883:1883”
- “9001:9001”

image: stjohnjohnson/smartthings-mqtt-bridge
- /home/bsharpe/volumes/mqtt-bridge:/config
- “8080:8080”
- mqtt

I have gone through this a few times to make sure I set it up correctly. I can see the events in the Smartting-Bridge logs so it is working. Now after reading may post on here I realized I had to enter the devices manually. So created a 'sensor.yaml" for these door contacts. Below is what I have but it is not seeing the. What am I doing wrong? I want to know when it is open/closed and battery management.


  • platform: mqtt
    name: “Front Door Contact”
    state_topic: “smartthings/Front Door Sensor/contact”
    retain: true
  • platform: mqtt
    name: “Front Door Contact”
    state_topic: “smartthings/Front Door Sensor/contact”
    command_topic: “smartthings/Front Door Sensor/contact”
    payload_on: “open”
    payload_off: “closed”
    retain: true
  • platform: mqtt
    name: “Front Door Contact Battery”
    state_topic: “smartthings/Front Door Sensor/battery”
    unit_of_measurement: “%”
    retain: true

What did you put you contact sensors under “sensor” or “binary sensors” for mqtt? I have door contact sensor but was not sure what to list them under in mqtt types like covers, sensors, etc.



I am trying to use MQTT Explorer to view the commands sent from the Smartthings Bridge, but when I use the MQTT Broker address I don’t get any events even though I can see events in the Smartthings Bridge status in HA. Has anyone used MQTT Explorer for this and if so, which broker address should be used?

I cannot find the SmartApp on my mobile device after following the steps to that point. I copied the code, it saved and published (For Me) just fine, but when I select My Apps under Add a new Smart App on my phone, there’s nothing there.

If you are just trying to set this up for the first time, I would recommend taking a look at the newer built-in integration between Home Assistant and SmartThings, rather than trying to use MQTT:

Does does this new integration still use cloud for getting motions sensor data or a ZigBee switch status update to home assistant?

I am torn between using the bridge or just connecting to a zigbee stick which are not very expensive. But I have many automations in smart things

Yes, SmartThings still runs through the cloud, so you are still dependent on that and subject to any issues that may crop up.

I came from SmartThings to Home Assistant as well, back in December, but fortunately most of my devices could integrate with Home Assistant directly. I didn’t have a ton of Zigbee/Z-Wave devices, so I just left the few I had directly in SmartThings with plans to move to a Zigbee/Z-Wave stick. Before I had a chance to do that, the integration came out, and since it was so simple to set up, I used that for awhile pretty successfully before migrating my devices over to a stick. I’d definitely recommend migrating to a stick as the best long-term approach, you’ll get more reliability, speed, and fully local control that way. But the integration works well as an intermediate option, so you can start getting things fully into Home Assistant and working on moving your automations over. I had quite a few automations in SmartThings using WebCoRE as well, and moving them to Home Assistant honestly was less painful than I anticipated. And once you get them moved over, Home Assistant is so much more powerful in terms of what you can do with automation.


The only thing I had left on my smartthings was a zwave schlage locks. For some reason with HA it would consistently disconnect and immediately drain the batteries. Also my garage door opening would also just stop responding and would require a power cycle.

I think since they removed the zwave heal automatically each day, my garage door controller hasn’t flaked, and also I have one of my schlage locks on the stick and this has been so far reliable. Hopefully this fixed the problem!

I would go that route but I’ve been trying to get DuckDNS set up for a week now and still cannot connect. The domain works because I can ping it, but I cannot connect to it. I also know something’s working because I can only connect locally via https. If I go this route I’m hoping to avoid the public url connection.

When I try to create the SmartApp I get this error:

No signature of method: script_app_metadata_9d8c5ad8_c6b6_42a4_8f4d_a0db2dbed16c.metadata() is applicable for argument types: (script_app_metadata_9d8c5ad8_c6b6_42a4_8f4d_a0db2dbed16c$_run_closure1) values: [script_[email protected]3546156a] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

Is anyone able to get battery states from any of their smartthings devices over this? I have everything working - motion, switches, power meters, etc - EXCEPT battery.

For example, I have a Smartthings motion sensor that I add as a Battery device in the Smartthings MQTT bridge app.

I add this to my configuration.yaml:

  - platform: mqtt
    name: "Living Room Motion Sensor"
    state_topic: "smartthings/Living Room Motion Sensor/battery/state"
    device_class: battery
    unit_of_measurement: '%'

But the sensor never changes from unknown. From what I see in the MQTT bridge logs, Smartthings is never sending any updates about it.

I thought this was just due to battery percentage not changing, but I’ve waited a week and can see battery updates shown in the Smartthings device’s “Recently” tab. Is this working properly for anyone else?

In case anyone else is having this problem - just wait longer. After ~2 weeks, the battery reports finally started trickling in.

sorry wrong post

anyone know how to get my mqtt and bridge talk to each other

so my setup is using docker to run my homeassisant Home Assistant 0.100.2 on linux computer 18.04 LTS

this are the docker images I’m using

my mqtt bridge

image: stjohnjohnson/smartthings-mqtt-bridge

my mqtt broker

image: matteocollina/mosca


image: homeassistant/home-assistant:stable

so my question is my setup appeared to be communicating well. I see the homeassisant login and get connected with my mqtt broker same as for my mqtt bridge and other sonoff switches log in and get connected successfully

my mqtt bridges log is this

info: Starting SmartThings MQTT Bridge - v3.0.0
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
fo: Saving current state
info: Connecting to MQTT at mqtt://
fo: Configuring autosave
info: Configuring API
info: Listening at http://localhost:8080
info: Incoming message from SmartThings: smartthings/Lock/lock = unlocked
info: Incoming message from SmartThings: smartthings/Lock/lock = locked
info: Incoming message from SmartThings: smartthings/Lock/lock = unlocked
info: Incoming message from SmartThings: smartthings/Lock/lock = locked
fo: Saving current state
fo: Saving current state

my mqtt log is

{"pid":1,"hostname":"b71191ec0d94","name":"mosca","level":30,"time":1571591230102,"msg":"client connected","client":"mqttjs_797451a4","v":1}
{"pid":1,"hostname":"b71191ec0d94","name":"mosca","level":30,"time":1571591131324,"msg":"client connected","client":"homeassisant","v":1}
{"pid":1,"hostname":"b71191ec0d94","name":"mosca","level":30,"time":1571591141240,"msg":"client connected","client":"sonoff_kmc_2","v":1}
{"pid":1,"hostname":"b71191ec0d94","name":"mosca","level":30,"time":1571591131828,"msg":"subscribed to topic","topic":"smartthings/Lock/battery","qos":0,"client":"homeassisant","v":1}
{"pid":1,"hostname":"b71191ec0d94","name":"mosca","level":30,"time":1571591131828,"msg":"subscribed to topic","topic":"smartthings/Lock/lock","qos":1,"client":"homeassisant","v":1}

my homeasisstant log is

2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on smartthings/Lock/lock: locked
2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on smartthings/Lock/lock: b'locked'
2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on smartthings/Lock/lock: locked
2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on smartthings/Lock/lock: unlocked
2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on smartthings/Lock/lock: b'locked'
2019-10-20 10:50:28 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on smartthings/Lock/lock: b'unlocked'

my question is regarding my schalage lock.
i see the lock being connected when manually locked and unlocked the doour using the know. The log “Incoming message from SmartThings: smartthings/Lock/lock = locked” but when i use my homeasssiant frontend to send the message to the mqtt or bridge i see nothing.

all other switches that are mqtt switches doesnt have any problem being controlled by my homeassisant frontend

- platform: mqtt
  name: "Deadbolt Lock"
  state_topic: smartthings/Lock/lock
  command_topic: smartthings/Lock/lock
  payload_lock: "locked"
  payload_unlock: "unlocked"
  optimistic: false
  qos: 1
  retain: false
  #value_template: '{{ value.x }}'

my setup used to work when i use my pi as my mqtt broker and bridge but theres alot of lag so i am migrating (NOT USING A DOCKER)

anyhelp or set of eyes that can see my mistake would be appreciate it. thanks