Home Assistant Community

Anyone integrated Smartthings into Hassio yet?

#1

Has anyone been successful with any of the guides that walk you through the integration in Hassio?

1 Like

#2

I’m not sure yet how to get started as it’s command line based and I’m not very familiar with linux… but I’m hoping to attempt this.

0 Likes

#3

There is an add-on for the SmartThings MQTT Bridge at Repository: Few addons.

1 Like

#4

Did you still need help with this?

0 Likes

#5

I’m new I did mqtt configuration to all in one home assistant, I’m just wondering it it the same processes, I do have SmartThings adon installed. What I have do next

0 Likes

#6

I’m writing a long tutorial on how to do this specifically a Raspberry Pi w/ Hassio installed, and the Hass.io plugins MQTT Broker and Vkorn’s SmartThings Bridge. Stay tuned!

As I was writing the tutorial, I figured out the issue why my door sensors weren’t communicating to HA. I wasn’t paying attention to case sensitivity…

1 Like

#7

This tutorial is for those using a Raspberry Pi with Hass.io, and the Hass.io add-ons: Mosquitto broker (included in default repository), and SmartThingsBridge (from vkorn’s repository). There are other tutorials out there, but not specifically using the items listed above. I’ll continue editing this post for corrections/cleanup.

For a basic understanding of how the communications works from Smartthings to Home Assistant and vice versa, check out this image posted on the HA blog. It won’t make sense now, but should later on. We are creating the Bridge SmartApp (in SmartThings), Device Type (in SmartThings), Rest Bridge (in HA), and Broker (in HA) in this tutorial.

1) Install the Mosquitto (MQTT) Broker Hass.io add-on
Connect to your Home Assistant frontend using a web browser (e.g. http://hassio.local:8123)

  • From the Sidebar (click on the 3 horizontal lines in upper left corner), go to Hass.io>>Store icon>>Mosquitto broker add-on>>Open>>Install
  • Don’t touch the Options or the Network settings of the MQTT broker add-on. Ports should be 1883 and 8883. Here are my default settings:
{
  "plain": true,
  "ssl": false,
  "anonymous": true,
  "logins": [],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}
  • The default port of Mosquitto Broker is 1883–the SmartThingsBridge add-on will need to connect to this port. Check that this port is listed correctly in the SmartThings Bridge add-on options.
  • Make sure the add-on is installed correctly by checking the state and logs for any errors. You can see the state and logs when you view the add-on’s info from the Hass.io section of the Sidebar.

2) Install the SmartThingsBridge Hass.io add-on from Vlad’s (vkorn) repository

  • Connect to your Home Assistant frontend using a web browser (e.g. http://hassio.local:8123)
  • From the Sidebar (click on the 3 horizontal lines in upper left corner), go to Hass.io>>Store icon
  • In the section ‘Add-on Repositories’, add the repository ‘https://github.com/vkorn/hassio-addons’ and click ‘save’
  • A new section called ‘Vlad’s repository’ should appear and you should see his SmartThingsBridge hass.io add-on. Click on it, open, and install.
  • In the SmartThingsBridge add-on options, leave everything as default. If you installed the Mosquitto Broker Hass.io add-on, the MQTT broker default port should be 1883 and the MQTT bridge port 2080. Here are my default options:
{
  "broker_host": "172.17.0.1",
  "broker_port": 1883,
  "preface": "smartthings",
  "state_suffix": "state",
  "command_suffix": "cmd",
  "login": "login",
  "password": "password",
  "bridge_port": 2080
}
  • Make sure the bridge’s default port is 2080–the SmartThings device will need to connect to this port. You will need to make sure this port is listed correctly in the SmartThings device.
  • Note: I am not sure what the “broker_host: 172.17.0.1” in the Options means. I left it as-is because I was able to connect the broker and bridge using these default settings.

3) Create the Smartthings Device Handler and Device

  • Follow the steps in this tutorial, starting at the section 'SMARTTHINGS DEVICE’
  • I named my device handler as 'MQTT Bridge Device Handler and my device as ‘MQTT Bridge Device’
  • Double-check the preferences of your newly created Smartthings Device. You can edit the IP address and port, which should be the local IP address of the RPi hosting HA, and the port 2080, if you’ve been following my instructions.
  • I had issues creating a SmartThings device because I could not fill out the device sections ‘Location’ and ‘Hub’. You should have registered your Smartthings hub by now and it should show up under the ‘My Locations’ tab. My hub was registered, but it wasn’t showing up properly in the ‘My Hubs’ section. To fix this, I clicked on ‘My Locations’, my hub, then on ‘List Devices’. Once I navigated here, I clicked on ‘My Devices’ at the top section and was able to see my hub and devices. I was able to add a new device with the location and hub drop-down menu properly showing my Smartthings hub. It will just magically work one of these days.

4) Create the Smartthings SmartApp

  • Follow the steps in this tutorial (BUT ALSO SEE MY NOTES BELOW), starting at the section ‘SMARTTHINGS APP’. Stop after you’ve completed that section and return to this tutorial.

  • One difference in the tutorial you will need to change is that the MQTT bridge port you use is 1883, not 8080. We are using a different MQTT broker than what is used in the linked tutorial.

5) Add the SmartApp to your Smartthings instance

  • This step is briefly described in the tutorial, but here are the specific instructions to follow in the mobile app:
  • Open Smartthings mobile app, click on Automation icon (looks like a house) >> SmartApps >> Add a SmartApp >> My Apps >> MQTT Bridge SmartApp (whatever you named it)
  • I named my SmartApp as ‘MQTT Bridge SmartApp’
  • In the Inputs section when adding the SmartApp, select the inputs and the supported devices that you want to communicate to Home Assistant. I did not select any Philips Hue light bulbs since HA does a great job connecting to the Philips Hue bridge.

6) Edit the HA configuration.yaml file to enable the MQTT broker

mqtt:
  broker: localhost
  discovery: true
  discovery_prefix: smartthings
  • I’ve read forum comments saying that using ‘localhost’ should be fine. The tutorial says replace it with the location of the broker. You may need to experiment with this if things aren’t working for you.

7) Reboot and check if things are working

  • My preferred method to reboot is to go to the Dashboard >>Hass.io >> 3 dots button >> Restart Home Assistant

  • In the MQTT broker logs, do you see ‘new connection’ and ‘new client connected’? If so, that means the SmartThingsBridge is communicating to the broker

  • In the SmartThingsBridge logs, do you see entries like “Saving current state”, “Subscribing to…” or “Incoming message from SmartThings…”? If so, then SmartThings is communicated to the SmartThingsBridge.

8) Add your sensors to Home Assistant configuration.yaml

  • In my example, I am adding a Z-Wave door/window sensor that reports open/closed. We will use a MQTT binary sensor to represent this in HA. Other sensors can report more than on/off and you will need to use the correct MQTT sensor in your configuration.yaml. Look at the related components on this page to see the different MQTT sensors.

  • Find the names of your sensors by viewing the SmartThingsBridge logs at Dashboard >> Hass.io >> SmartThingsBridge >> Logs

  • You can also change the logger level in your configuration.yaml to show MQTT activity logs. Look up Logger component documentation for more info. My configuration.yaml looks like this:
    logger:
    default: critical
    logs:
    homeassistant.components.mqtt: debug

  • If you have a door/window sensor, open and close your doors (in real life), and then see if the SmartThingsBridge logs detected the action. In my logs, I saw “Incoming message from SmartThings: smartthings/Front Door Sensor/contact/state = open”

  • NOTE: this is case-sensitive! Open != open. Use the exact case listed in the logs when you create your sensors in configuration.yaml.

  • Create a section called in the configuration.yaml called “binary_sensor”. See below:

binary_sensor:
  - platform: mqtt
  name: "Fridge Door"
  state_topic: "smartthings/Fridge Door/contact/state"
  payload_on: "open"     #This is case sensitive!
  payload_off: "closed"    #This is case sensitive!
  device_class: opening  #Your sensor will read as open/closed instead of on/off with this setting
  retain: true     #this is important so HA doesn't report the sensor as disconnected
20 Likes

Schlage Connect, Smartthings, and Hass.io
Can't seem to get Hass.io and SmartThings (MQTT) working
Integrate HASS,IO + SmartThings with Google Home to announce Sensor Events or Variations
MQTT messages not updating HassIO switch state
#8

thanks for your help

0 Likes

Brand new HA install - trying to connect SmartThings hub
#9

Super helpful! Thanks so much for a clear and concise walk through.

0 Likes

#10

Where were you when I tried setting this up a week ago?! Setting the port number in the device in SmartThings to match the bridge_port in the Bridge configuration was the piece I was missing and didn’t find that anywhere else.

Thank you!!

0 Likes

#11

OP here. I was able to resolve my issue a few days after creating this post. The problem was my MAC address. I tried getting it from running ifconfig on the Pi and the MAC address it was returning was for Docker and not the actual Pi. It’s been so long now that I can’t remember the way of getting the real MAC from the Pi but I’m sure someone can chime in with that answer.

I didn’t read the tutorial that was posted above but it sounds like its already helping people so I’m super happy abut that! Good luck to everyone and just know that it IS possible to get working!

0 Likes

#12

lol, last week I was also trying to figure it out. After reading through the tutorials, I eventually learned that the tutorials I read were correct for their specific configurations, but not mine (Hassio install and Hassio plugins). The other tutorials used a different MQTT broker and bridge default settings, so I eventually traced back the errors to the port numbers used. Tutorials are helpful but we shouldn’t be too dependent on them if we really want to understand HA…

I also read somewhere and learned why the Hassio MQTT broker plugin options lists ports 1883 and 8883. Port 8883 is used if SSL is enabled, 1883 if SSL is disabled. I would love to know if anyone was able to turn on SSL with the broker!

0 Likes

#13

Hi dwinn,
Thank you for the time and effort on this tutorial. I’m new to HA and I have been looking out a method for integrating smartthings with HA. I found yours and I followed your step to setup! As you mentioned, sanity checks like for MQTT broker connection shows starting version 3.2.2
1513692029: mosquitto version 1.4.12 (build date 2017-06-01 13:03:48+0000) starting
1513692029: Config loaded from /etc/mosquitto.conf.
1513692029: Opening ipv4 listen socket on port 1883.
1513692029: Opening ipv6 listen socket on port 1883.
1513692029: Warning: Mosquitto should not be run as root/administrator.
1513692029: New connection from 172.30.32.1 on port 1883.
1513692029: New client connected from 172.30.32.1 as 41d3ef5e-de10-4b4f-8a80-1f89349e6bf3 (c1, k60).
1513692919: New connection from 10.0.10.11 on port 1883.
1513692919: Socket error on client , disconnecting.
and similarly SmartThings Bridge logs also show info: Saving current state
info: Connecting to MQTT at mqtt://172.17.0.1:8888.
Does it seem right? I did add the switches in the Configuration.yaml file and after restart the I see switches on the homescreen but doesn’t work. Could you please help me on this issue?
Thank you

0 Likes

#14

Double check the ports you defined. I never used port 8888 in my tutorial, but your logs show that the Smartthings Bridge is trying to connect to the broker at port 8888.

0 Likes

#15

Well done guide!

Might I ask if you have a few examples of a light and a switch perhaps?

0 Likes

#16

I finally bought some Sengled Zigbee light bulbs on sale from Amazon and added them to SmartThings and HA. If your bulb supports RGB, then you need to add more parameters than what is listed here. I don’t fully understand the ‘optimistic’ variable, but it was used in an example. Here is what you should write in your configuration.yaml file.

EDIT 1/13/2018: I didn’t fully test this config and realized
that turning on/off and changing brightness doesn’t work from HA, but on/off states are reported correctly. Anyone else have this problem or a solution?

light:
  - platform: mqtt
    name: "Bedroom Light"
    state_topic: "smartthings/Bedroom Light/switch/state"
    command_topic: "smartthings/Bedroom Light/switch/cmd"
    brightness_command_topic: "smartthings/Bedroom Light/level/cmd"
    brightness_state_topic: "smartthings/Bedroom Light/level/state"
    payload_off: "off"
    payload_on: "on"
    optimistic: false
0 Likes

#17

Great guide!! It was pretty easy to follow and seems that everything is working. I do have a little issue in that when I look at my logs for the plugins I see messages that look like things are working but I do not see anything about the actual devices or device names so I don’t know how to create them in HASSIO so I can see them and use them.

In the MQ Broker I see these kind of messages:
New Connection from 172.x.x.x on port 1883.
New Client connected from 172.x.x.x as 89xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx (c1, k60).
Saving in-memory database to /data/mosquitto.db.
Saving in-memory database to /data/mosquitto.db.
Saving in-memory database to /data/mosquitto.db.

In the SmartThingsBridge logs:
Loading configuration
Loading previous state
Connecting to MQTT at mqtt://172.17.0.1:1883
Configuring autosave
Configuring API
Listening at http://localhost:2080
Saving current state
Saving current state
Saving current state
etc…

0 Likes

#18

This tutorial is EXACTLY what I needed. I am a newbie to all of this and currently use SmartThings, Webcore, and ActionTiles for home automation, but have an extra RPi and decided to try out HA.

Are there any good examples out there of configuration.yaml entries for different devices?

0 Likes

#20

I wonder if you didn’t configure the Smartthings MQTT bridge app correctly. You have to open the Smartthings app on your phone/tablet, navigate to the MQTT smartapp you created, then make sure you added all your sensors and switches in every setting (battery, contact sensor, switch level, etc). Then generate some activity on your sensor by opening/closing a door, and check your logs for the SmartBridge add-on.

0 Likes

#21

I deleted all the smartthings pieces and recreated them and now it’s working. Thanks!

0 Likes