My SmartThings setup for my home (the logic)

In the recent blog posts I described how I setup the different sensors and connected my Nest thermostat. But the real automation or getting things convenient is by tying everything together. I have been struggling to get everything to work. One time 1 part was working but it didn’t go to another state automatically and suddenly the lights went out when I didn’t want it to happen etc.

What helped me was drawing the following diagram and after that go through the app to define/configure all the different states (in the end, SmartThings is nothing else than a state machine)


The states, Home, Night and Away are already defined in ST. If you go to the activities (those are in bold at the lines) you can configure them 1 by 1. For example you go to ‘I’m Back’. I have configured to turn on some lights and change the mode to ‘home’. At additional settings you can configure ‘automatically perform ‘I’m Back!’ when.. I have configured ‘Someone arrives’ (connected to Sandra’s and my presence sensor) and ‘Things start happening’ which is the motion sensor, so when I come home through the front door or garage and the presence sensor isn’t detected yet the lights turn on anyway.

The 1 thing left to do is connect all this to sunset/sunrise. If I return home during the day I don’t want the lights to turn on. So I want to add another state which is ‘Home sunrise’ or something like that which is a different state than home. That state doesn’t need the lights to come on. Creating a chart with that state added and the different transitions will help me configure the SmartThings hub the way I want.

Get the device name of your Windows Phone

I am updating my rubber duck app and I want to store the amount of ‘squeeck’s per device in roaming settings. So you can see the total but also how much you squeezed the duck on every device.

I am storing this as key value pair and the key is the device name.

So how do you get the device name? You can’t. There is (as far as I know) no API to get the device name.

So when searching around I found this trick which I am documenting for myself here in this post.

Windows.Networking.Proximity.PeerFinder.DisplayName will give you the name a user gave his device.

Not sure how robust it is yet. It seemed to work on my phone, but when I check the name in internet sharing in my emulators they say something like ‘Microsoft Virtual_6262’ but the API returns ‘Windows Phone’ so apparently these 2 aren’t the same. That’s ok since you can change the broadcast name for internet sharing in the UI and renaming your phone needs to be done when it’s connected to your PC.