Bought a SmartThings hub

Last week I got myself a SmartThings hub. I was already looking for some time to get into to home automation. I have a NEST thermostat, some Philips Hue lights but wanted something more.

These are the scenarios I want to try to solve:

  • I would love it when I come downstairs in the morning the lights come up (but only when it is still dark) and Sonos starts playing my music. When I leave for work, the lights need to go out, music needs to stop but the heating needs to keep the same temperature for Sandra.
  • When I come home and Sandra is already at home, nothing needs to happen, but when I or Sandra gets home and nobody is there the lights need to come up (when it’s dark only) and the heating needs to be switched on.
  • When we go to sleep I want to turn everything off with 1 button.
  • The lights at the front door and garage need to automatically turn on when it’s dark and switch of when sunrises.
  • When we are away for a longer time it would be nice if the house could look ‘alive’
  • Windows Phone support.
  • Optional it would be nice to use the system from a tablet which I could put on the wall at a central location.
  • I will probably mostly buy z-wave products

At the time I was doubting between the Vera and the Smartthings, both systems have a good community support although it looked the Smartthings stuff is more active and easier to extend myself when I want as well. Disadvantage of the ST is it always needs an internet connection. The Vera could work offline.

Since I also visited the Samsung conference a couple of weeks ago (Samsung bought ST) I got more enthusiastic after I saw a few sessions. So I went with ST and see how it goes (I can always switch to another system since the connectors, switches etc all work with other systems too)

First thing you need in this system is the hub.


Costs $99. Installation is easy. Hook it up to your network. power on. Start the ST app on your phone and add the hub by entering a special code you find in the box. That’s it.

After this you can add ‘things’ and smartapps to your system. Since I didn’t have any z-wave devices yet I added my HUE lights first and my Sonos players.

The NEST took some more work. Since it is not yet supported out of the box (but it is announced) I had to do some work. On the developer website you can login with your account and through the web-based IDE you can add custom device types yourself. This is the system to extend your ST with new devices, you can add your own developed ones as well. I got the code and instructions from here.

This is the data you can get back and use in your logic when automating your home


The apps and devices are written in a language called groovy. This is how it looks like:

// handle commands
def setHeatingSetpoint(temp) {
    def latestThermostatMode = device.latestState(‘thermostatMode’)
    def temperatureUnit = device.latestValue(‘temperatureUnit’)
    switch (temperatureUnit) {
        case “celsius”:
            if (temp) {
                if (temp < 9) {
                    temp = 9
                if (temp > 32) {
                    temp = 32
                if (latestThermostatMode.stringValue == ‘auto’) {
                    api(‘temperature’, [‘target_change_pending’: true, ‘target_temperature_low’: temp]) {
                        sendEvent(name: ‘heatingSetpoint’, value: heatingSetpoint, unit: temperatureUnit, state: “heat”)
                } else if (latestThermostatMode.stringValue == ‘heat’) {
                    api(‘temperature’, [‘target_change_pending’: true, ‘target_temperature’: temp]) {
                        sendEvent(name: ‘heatingSetpoint’, value: heatingSetpoint, unit: temperatureUnit, state: “heat”)

Once you get these things hooked up you can start playing with certain events. I will try to write blog posts once I got my new sensors at home. I ordered z-wave switch, z-wave 3 way dimmer, motion sensor and energy monitor. When I get this stuff to work I want to add some stuff so I can operate the garage door as well.