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.
I tried to add another z-wave switch to my SmartThings network. I bought a on/off switch at Lowes (all the ‘works with Iris’ stuff you can use in your z-wave network), this is just a GE 1-way on/off z-wave switch, to connect to my outdoor lights so I can switch them on/off automatically with sunset/sunrise.
When I connected it to the 2 black wires which were used to the existing switch the lights didn’t come on. Although the led on the switch itself lighted up.
After some searching and reading the manual a little better I found out I needed to connect the neutral wire. Fortunately there is a neutral wire in this wall mount. I checked my study and that doesn’t have one. The weird thing is the z-wave dimmer works without the neutral wire.
So after wiring up the neutral wire the outdoor lights started working.
So I found some information on the SmartThings forum to explain what was going on.
No neutrals is a bad thing, unfortunately. You can use once of the switch types that don’t need a neutral, but they do have limitations.
First question: If these are three-way switches, there should be at least three wires. In the first box there should be a hot line (from the breaker/fuse box) and two wires (called traveler wires) going to the next box. At the second box there should also be three wires. The two traveler wires from the first box, and then one load wire leading to the light.
If this is what you have then you can look at Levitron which appears to have both switches and aux switches that do NO require neutrals. See this page: In particular, look at the setup in part 4B. This is what your setup should look like.
Second question: Why only Incandescent bulbs? The important thing to remember is that old “dumb” switches are simple mechanical devices. By flipping the switch you are mechanically connecting or disconnecting a circuit. The switch is nothing more than a path for power to move through.
However, a z-wave “smart” switch is an electronic device in and of itself. Yes it opens and closes the electrical circuit for your lights, but it also has a small radio built in as well as various other electronic components that control dimming, current state, etc. Because this is an electrical device it requires power all the time. This is whymost switches of this type need a neutral. The power used to “run the switch” comes from the hot, then goes out the neutral.
But some switches obviously don’t require a neutral… how do they operate then? They operate by allowing a small trickle of energy to move through the circuit. Enough to operate the switch, but not enough to make an incandescent bulb light up. These switches take advantage of the fact that incandescent’s need a (relatively speaking) high level of power before responding with light.
CFLs, on the other hand, take less juice and this constant trickle is enough to occasionally make them flicker or blink. Having a constant small level of juice probably isn’t very helpful to the ballast and other parts of the CFL either, potentially shortening their life considerably.
Similarly LEDs require a lot less juice too. Meaning that small trickle might be enough to make them come on at a dim level even when the switch is “off.” Theoretically if you have enough of a load of LED lights you might be able to get by without this switch lighting up your LEDs. For example, in one room of my house I have 4 LED lights each taking like 16 or so watts. That just might be enough to prevent them from lighting up (I don’t know for sure as I’ve got a switch with a neutral… just same it might be enough).
Okay… so this explanation ended up going long. Sorry ’bout that. Also, I hopefully I didn’t sound like I was talking down to you. Not sure how much you know or don’t know so thought I’d start with the basics.
In other words. if you don’t have a neutral wire, on/off could work with specific switches and regular light bulbs.
A couple of months ago I bought a Nissan LEAF. It comes with a trickle charger you can connect to your 110V outlet but it takes a bit of time to completely charge your car (over 12 hours). I leased the car with a fast charger pack which makes it possible to charge the car in a couple of hours if you have a 240V charger.
I decided I wanted to install this myself. I bought a Bosch EL-51253 Power Max 30 Amp charging station with 18’ cord. I also bought a NEMA 14-50R outlet I wanted to put in the wall. And I bought a Electric WX9X35 4-wire Range cord to connect to the charger so I could plug it in the wall.
Connecting the range cord to the charger is easy. Open it up on the back and connect 3 wires (you only need 3, the white wire isn’t used because only 3 wires go from the breaker to the NEMA outlet).
The 240v connection wasn’t that hard. Most of the time I used to figure out what the exact rules are here in the US. It’s a bit different compared to the Netherlands (Yes I read the NEN1010 in NL when I was in school). I did a lot of research online to figure out what is allowed or not. I requested a permit (this is different per area, even Redmond and Bothell are different, some areas you go to the power company, some you go to the city. For Bothell I needed to go to the city and pay around $60) and after everything was hooked up, somebody from the city came by and approved the installation. (You don’t want to fight with your insurance when your house burns down because you made a mistake )
First I needed an extra breaker in the outlet panel. This house is a new build so the panel is new. I could just add an extra 40A breaker. Here in the US they use 110V outlets although 240V comes into the house. The breaker for your dryer is also 240V.
After I switched of the main breaker I added the new breaker. (btw, although the main breaker is switched off there is still current on the main thick feeder line at the top of your breaker box!). Just make sure you use a breaker which fits on the panels connectors.
Adding the breaker in the panel is easy, just click it in.
That was the easy part
I was lucky I wanted the outlet really close to the breaker panel. I bought some materials at Home Depot and started working. I used this wire which allows 55A and in the wall usage. First I needed to cut out the hole in the wall.
Opened up one of the holes in the panel to feed the wire
Make sure you put in this plastic ring before you feed the wire (you need this if you want to get the permit approved afterwards)
Strip the wire and feed it to your breaker and attach the ground to the ground block
Feed the wire to the outlet (only 2 wires and 1 ground)
Connect the NEMA connector, I connected the ground and the 2 L wires.
Et voila, done
I am happy with the result
Update: Although my charger doesn’t use it, I would recommend adding the extra wire from the breaker to the NEMA plug and just connect it (neutral wire goes into the neutral bar). So for future use the NEMA connector is wired completely and would save some frustration of you use it in the future but forgot 1 wire was missing 🙂
There are still a couple of things I would like to automate in my house. For one when everybody leaves the home the home should switch to ‘away’ mode. The other one which would be nice is if I get home with the car the garage door opens automatically or closes when you leave the house.
First thing I tried was setting up the Windows Phone from me and Sandra to use as a presence sensor. You can do this through the SmartThings app. But after some experimenting this isn’t a reliable way to detect if you are at home or not. Not sure what the exact problem is but I don’t think this is a Windows Phone 8.1 app using geo-fences. One of my friends uses his iPhone and that is pretty accurate.
So I bought to SmartSense presence sensors on Amazon (they ship in days, when I order at the SmartThings website it takes much longer for the same price!?)
First experiment was putting these things in the glove compartment of the cars. I added the 2 devices to the network (just follow the instructions it’s easy)
When driving away from the house it takes around 5 minutes before it detects I left the house. (little over 1 mile away). That’s not good enough to close the garage door automatically since it will be open without me being there for some time. It looks like it polls only so many minutes (when I check the log). Not sure if that’s true or not.
Detecting when I am home is a bit spotty too. When I drive to my house it detects me or Sandra is home when we park the car in the garage. So it’s not good enough to open the garage door automatically. You can set an amount of minutes you are not present before an action triggers. This is a good setting because you sometimes get a false message about one of the sensors not being present.
I found out the sensor is usable for setting the house to ‘away’ automatically. I connected the sensors to our keys (which we bring with us all the time). So when Sandra leaves the house on her bike or walks Lisa to school it also works. It’s not bound to just the cars.
I programmed the ‘away’ mode in the app to automatically go to away when everybody leaves the house. I also changed the ‘I’m back!’ to automatically when ‘somebody arrives’, together with the motion sensor this works really well.
The scenario for the garage door might work together with your iPhone or Android phone. My friend had a problem with this the garage door also opened automatically when he returned from walking the dog. If you combine this with 2 sensors in both cars you could program the ST hub to automatically open the garage door when arriving (with your phone) and your car is not present. That would be accurate enough to make it really convenient. I hope ST updates the Windows Phone app some day to make this scenario workable. At that time I will buy a automatic garage door opener and sensor to detect if the door is open or closed.
Last week I ordered this motion detector for my home. I want to use it to automatically switch some lights etc in my SmartThings network.
Connecting the motion detector to the network is easy. Just follow the instructions. I use this for 2 different scenarios. 1st scenario is when I go downstairs in the morning, the sensor detects me coming down the stairs and tells the house ‘Goodmorning!’, that turns the lights on, turns the Nest to 69, if it isn’t already and turns on the Sonos on my favorite radio channel. The 2nd scenario is when the house is in ‘away’ mode. I want the motion detector to tell the house ‘I’m back!’ this makes the lights turn on and put the Nest in ‘home or present’ mode. I will write another post how I programmed these 2 scenarios in SmartThings.
So does the motion detector work? Yes it does, there are some caveats to be honest. When it detects motion it stays in this mode for at least 4 minutes. When it doesn’t detect motion it ‘turns off’ for at least a minute before it detects motion again. I did not figure out how I could change these timings, I guess it’s done to save battery. For my scenarios that’s ok but if you would like to use it to automatically switch on and off the bathroom lights for example I wouldn’t use this sensor. The price is pretty good. $28 for this sensor isn’t that expensive I think.
The sensor comes with a wallplate and some double sided tape. I positioned it in a spot where it can detect us coming down the stairs, enter the frontdoor or enter the kitchen through the pantry. So these 3 areas and my 2 scenarios cover everything I currently want.
I wanted to make it even easier for myself when I leave and enter the house. What we do now when we leave the house we set the Nest to away and when we return we set it to Home. That’s something we can automate with SmartThings.
So when I set my home to goodbye the Nest goes in ‘away’ mode and when ‘I am back’ the nest goes in to ‘home’ mode. That’s all.
I don’t need to connect the motion sensor since that’s already hooked up to the different modes in SmartThings, I only need the nest to respond to those mode changes. So I might change the script a little in the future to adjust it to just this scenario.
So go the web IDE and create a new smartApp. Select From code and paste the code, save, and publish to me.
Go to your phone and use the app to add the custom app, hit the + swipe to My Apps and select the Thermostat Away mode app.
As I described in my previous post I want to create a couple of scenarios in my house.
The first one is a simple one. I want my lights at the front of my house automatically turn on and off when the sun sets and rises. I replaced my outlet switch with a z-wave switch and connected it to my SmartThings hub.
After that it’s easy. Go to your SmartThings apps. Click on the + sign on the bottom of the page. Swipe to Actions. Select Lighting. Choose ‘Turn lights on using a schedule’, ‘Add new light/switch’, give it a name, in my case ‘entrée’, Next, choose devices for ‘entrée’, select what you want to switch on at the entrée so I selected my switch. Check the ‘turn on at Sunset’, you can specify the level of the dimmer as well. Next and Done.
Now repeat this step to turn lights off using a schedule to turn the lights of in the morning at sunrise.
There is probably a smartapp which can do the same, but this way you don’t have to go the webpage and add the apps through the IDE.
Since I bought the SmartThings hub and several switches and sensors I was thinking which scenarios I exactly want to work. So far I have been fooling around and I found out if you want a complete working set of scenarios without me using the app all the time to set my house in a state I want, I need to think it through and build all the scenarios from the beginning. So step 1 is writing the scenarios down and determine what the conditions are.
So I am listing the scenarios and will give them a number and can work from that list.
Outdoor lights at the front door need to turn on at sunset and turn off at sunrise.
In the morning when I come downstairs the lights in the kitchen and living need to turn on. The Sonos need to turn on in the Kitchen. Temperature set to 69. I want to use a motion sensor to detect when I come down in the morning. Conditions: Lights turn on when it’s still dark outside (before sunrise). When somebody comes down before 5:00 in the morning the Sonos does not have to turn on. When I come down in the morning I want to switch to ‘good morning status’ When I come downstairs before 5:00 the lights need to turn off automatically when no motion is detected after 5 minutes.
When the status is ‘away’ and motion is detected switch to ‘I’m back’ and turn on the lights when it’s after sunset. The Nest needs to be set to ‘home’ when it’s in ‘away’ mode. This is when we come back through the garage or the front door (after work, or shopping or taking a walk for example)
When I switch the house to ‘good night’ everything needs to switch off automatically after 5 minutes, which gives me some time to connect my phone to the charger, put the empty cup in the kitchen etc and head upstairs. Temperature is set to 60.
When leaving the house I will set the status manually to ‘goodbye’. Lights will turn of after a few minutes, and Nest is switched to ‘away’ immediately. When I return home scenario 3 needs to kick in.
When I leave to work I want to set the mode to ‘goodbye to work’ which means only the lights and Sonos is switched off but the Nest is left as it is. So when Sandra comes downstairs the temperature is still as we want it to be.
All these scenarios need to work without me needing to use the app. I am ok switching the lights off in the morning when it’s getting lighter outside. I might add a light sensor in the future to do this automatically as well.
When this works I want to add a sensor to our cars so the garage door can automatically open and close when we arrive and leave with the cars too.
I decided not to mess around with the ‘auto’ away settings etc from the Nest in combination with the SmartThings hub. That’s way to complicated and doesn’t add any value I think.
You have to open up the energy meter and instead of holding the black little button for 5 seconds (that didn’t work for me) I pressed it shortly several times until the light started blinking quickly. After that I could add a device in the SmartThings app and it found it immediately.
Hooking up the energy meter in my breaker panel was easy. Just connect the 2 clamps to the 2 big black wires (don’t touch them duh!) and power the meter with the usb cable and the connector in a outlet.
After this I logged in on the Web Ide from SmartThings and added a custom device type. You go to the my Device Types tab. Click on +New Smart Device, select the from code tab and I pasted the code from this github repository https://github.com/SANdood/Aeon-HEM-v2
After that go to ‘My Devices’ Select your energy meter, click edit and change the type to Aeon HEMv2. After this when you open the app you will see the amount of energy the meter is reporting. (I have to figure out what the 2 empty spots are on the left and change the script a little bit)
Next will be using a script to report this data to Xively or Bidgely to see some data over time. (and figure out if 700 Watts energy usage in the evening is a lot or not )
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:
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.