SmartThings with MQTT and Home Assistant

I’m using SmartThings hub in my home automation. While it has been working reasonably well, it is missing some features that I would love to have. Home Assistant is an open-source home automation platform which supports a lot more devices and has the components that I need in my smart home.

In this post, I’ll show you how to setup SmartThings with MQTT Bridge and Home Assistant, so that information can be shared between SmartThings and Home Assistant. It runs on a Raspberry Pi 3 and uses Raspbian Stretch (Debian 9) in Python virtual environment (not Hass.io).

 

This guide assumes

  • Raspberry Pi’s IP address is 192.168.1.101
  • SmartThings’s IP address is 192.168.1.207

 

Home Assistant

Install dependencies for Home Assistant

Create user & group for Home Assistant

Create installation directory for Home Assistant

Install or Update Home Assistant

Create Autostart using systemd

Add the following to /etc/systemd/system/home-assistant.service

Reload systemd and start Home Assistant automatically at boot.

Run Home Assistant

Fresh installation will take some time to complete setup.

Home Assistant Frontend

Browse to http://192.168.1.101:8123  to open the Home Assistant Frontend

 

Install MQTT Broker

I’m using Mosquitto as the MQTT broker in my setup.

 

SmartThings MQTT Bridge

Install Node.js & npm

Install smartthings-mqtt-bridge

Configure smartthings-mqtt-bridge

Add the following to /config.yml

Install supervisor

Supervisor is a process control and monitoring system to ensure process runs forever. Smartthings-mqtt-bridge suggests PM2 but I prefer using Supervisor.

Add the following to /etc/supervisor/conf.d/smartthings-mqtt-bridge.conf

Execute the following to run smartthings-mqtt-bridge

 

SmartThings

Install smartthings-mqtt-bridge’s Device Handler and Smart App for SmartThings

  • Install the Device Handler in the Device Handler IDE using “Create via code”
  • Add the “MQTT Device” device in the My Devices IDE. Enter MQTT Device (or whatever) for the name. Select “MQTT Bridge” for the type. The other values are up to you.
  • Configure the “MQTT Device” in the My Devices IDE with the IP Address (192.168.1.101), Port (8080), and MAC Address of the Raspberry Pi.
  • Install the Smart App on the Smart App IDE using “Create via code”
  • 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
  • Via the Native App, select your MQTT device and watch as MQTT is populated with events from your devices

 

Configure Home Assistant

To add SmartThings devices to Home Assistant over MQTT, first enable MQTT in Home Assistant:

Devices from the MQTT Bridge are published to the path smartthings/<Device Name>/<Attribute>

For example, this is my contact sensor from SmartThings:

 

With this setup, I can have the best of both worlds. SmartThings is the main hub, and Home Assistant complements SmartThings with additional features.

 

Further Reading

By | 2017-12-13T10:45:28+00:00 Dec, 2017|Categories: Smart Home|Tags: , , |0 Comments

Leave A Comment