Project Description

This is a sample project demonstrating MVVM and "Build for Both" practices using the Philips hue lighting system.

This project served as the demo for the "Build for Both: Writing and Designing for Windows 8 and Windows Phone" presentation at TechEd 2013.

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/WPH-B303#fbid=DOyEk0reyuo

This demo was also used at the Build 2013 session "This App Is Brought to You by MVVM– Hulu Case Study Build"
http://channel9.msdn.com/Events/Build/2013/2-205

!!How to use this project
This is a demo project originally presented at TechEd 2013 as a “Build for Both: Windows 8 and Windows Phone” presentation and then at Build 2013 for an MVVM presentation. The goal of this project is to give a concrete example of how one might build an application targeting both Windows 8 (or 8.1) and Windows Phone 8.

This project is not intended to be a how-to on programming the Philips Hue lights. For a wealth of information on the Hue apis, go here http://developers.meethue.com/. While you can piece together how that is done and duplicate it using this project, some things in this project are hard-coded in order to take some of the uncertainty out of the intended demo. This can make this project a little harder to get started, but it also makes it a less fragile solution in front of a live studio audience.

!!Setting up your Hue Lights

Get your Hue lights out and powered up. Then power up your Hue Bridge and connect the bridge to your router. Open up the HueControlViewModel.cs file in the HueDemoPCL project and go to the BridgeIP property (line 50) . If you’re online, this IP address can be found by going to

http://www.meethue.com/api/nupnp

This will return a JSON object with the internal bridge IP address.

If you are not online (I am usually using an offline router when I give this demo to keep the demo as isolated as possible), you can find the Hue bridge IP address by going to your router admin panel (192.168.1.1 for my NetGear) and look for the Hue bridge. In my NetGear router it is under the “attached devices” tab, in the Linksys it would be under “DHCP Clients Table”.

Your application will need to register as a user with the bridge. Once registered, the username is persistent on the bridge so you can use the same username again and again. If you’ve pre-set the BridgeIP property, all you have to do is set the username using the UserName property and then run the UpdateSettings command.
Once you have the correct IP address and have registered a username, the rest of it is cake. Use the GetLights command to get the current status of all the lights, use the UpdateLight commands to change the lights, use the CycleLights command to cycle the light settings across the different lights.

And hat’s how to get started with the Hue lights MVVM demo.

Coming soon… a detailed explanation of how MVVM is implemented in this project. While I’m working on that, you can check out my TechEd 2013 talk - [url:http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/WPH-B303#fbid=DOyEk0reyuo
or my Build 2013 talk http://channel9.msdn.com/Events/Build/2013/2-205 in which I walk through some of the highlights of this demo and you can see it in action.

Last edited Jun 28, 2013 at 4:51 PM by matthiasshapiro, version 3