Monday, January 24, 2005

Build Lights

Inspired by Bubble, Bubble, Build's in Trouble over at Pragmatic Automation, I set up something at my client that is extremely cool. And by “cool” here, I mean “almost painfully nerdy”.


Basically, I've hooked up a series of colored lights to our CruiseControl.NET build. Via X10 automation, I turn on red, green, and/or yellow lights based on the status of the build. It looks like this:



Since I put them up on top of my cube, the lights are visible across most of the part of the floor where my team sits. I already find myself looking up to check the status whenever I arrive in the morning.


The reason that two lights are on in this picture has to do with the semantics I attached to the signals. The red and green lights indicate whether the last build was successful or not. The yellow light indicates that a build is in progress. I could have shut off the red or green light while a build was running, but I thought this way added a little more information while still being very easy to understand at a glance.


It was actually pretty impressive how easy this setup was to get going. After ordering an automation kit ($99 from http://www.x10.com), downloading the free SDK, and stopping off at Target for some cheap lamps and some bulbs (about $25), some simple perusal of the samples showed that it's basically one line of very easy-to-understand code to turn each light on or off. Monitoring the build was only slightly harder: I just used cctraylib.dll from the CruiseControl distribution to poll the build state. That was maybe 20 more lines of code. Rolling it all up into a service (so it will continue to work when I'm not logged on) took me about 90 minutes total.


The kit came with a bunch of other stuff that I'm not using, like remote controls and a motion sensor, so I probably could have gotten off a little cheaper. But when I finish my gig here, I'll take the whole thing home and find a use for it around the house. Hopefully something equally nerdy. :)

30 comments:

  1. Careful with that Axe, Eugene!



    My most requested presentation for the .NET user groups I present at has been "Home Automation with .NET". You just arrived at the entrance to a very deep rabbit hole. Welcome!



    I'm presenting my Home Automation with .NET presentation next month, I'm definitely going to share this idea with them.



    I use my setup with Media Center to turn the lights on and off and to set the thermostat from the MCE remote. You'll never sleep again. Especially when you can control your sprinklers from your MCE Extender. ;)

    ReplyDelete
  2. Truthfully, I'm having a hard time figuring out more than a few simple uses for automation at my home. I never touch the thermostat, and with one or two exceptions, the lights switches are in reasonably easy-to-get-to locations already. I don't have a home theater, and the problem of "where's the damn remote" seems to be a major one.



    What sorts of things am I failing to think of? What kinds of cool stuff can I do?

    ReplyDelete
  3. So are you going to post the code to integrate with CCNET? That's pretty sweet.

    ReplyDelete
  4. Cool post Craig.



    On the NxOpinion project, we have used the Ambient Orb:



    http://blogs.msdn.com/mswanson/articles/169058.aspx

    ReplyDelete
  5. I'll see what I can do about getting the source up. I have to ask permission, because I did it on a client's time, so they own it.



    I've heard about Ambient Orb, and it's pretty cool. This approach had the dual advantages of being very slightly cheaper and being usable for lots of other purposes afterwards.

    ReplyDelete
  6. You are SUCH a nerd. :)

    ReplyDelete
  7. If you can't get permission, let me know and I'll post some that I wrote. I'm not fortunate enough to have clients that pay me to goof off with X-10. ;)

    ReplyDelete
  8. Maybe the client will want to buy the lights since they own the code.



    I smell a future cable show...



    Home Automation for the extreeme nerd:

    1. Water your plants (killer robots optional)

    2. Start the dishwasher when you forgot, or use a scale and trigger washer's start based on wait load, send status information to the web for remote monitoring.

    ReplyDelete
  9. You sick, sick man...



    On the consulting front, if you're having a hard time coming up with ideas for household uses for X10, consider what it could do for the pr0n industry. I'm sure you could make a buck or two there with your innovations ;)

    ReplyDelete
  10. Thanks for all the "suggestions" everyone. :p



    Clint: why on earth would you think the killer robots are *optional* ?

    ReplyDelete
  11. Excellent! I'd love to post some .NET code over on http://pragmaticautomation.com.

    ReplyDelete
  12. OK, I got the go-ahead. I'll pull the code together and post a link to it in the comments here. Might take me a day or two.

    ReplyDelete
  13. Darn. Having only email notifications of build results feels *so* lame now... Sigh.

    ReplyDelete
  14. Heh. It's just a fancier version of cctray, really. You *do* run cctray, right?

    ReplyDelete
  15. Code has been posted.



    http://pluralsight.com/wiki/default.aspx/Craig.BuildLightsCode



    Enjoy.

    ReplyDelete
  16. I agree with the statement "Truthfully, I'm having a hard time figuring out more than a few simple uses for automation at my home. I never touch the thermostat, and with one or two exceptions, the lights switches are in reasonably easy-to-get-to locations already. I don't have a home theater, and the problem of "where's the damn remote" seems to be a major one. "



    Just give me something that will bring me coffee in the morning! Oh and a remote finder!

    ReplyDelete
  17. Craig I have a few suggestions on HA projects.

    water sprinklers- I program for a living, and I still cant get the sprinkler controller to work correctly.



    Dog Feeder/waterer- I never get home at a decent hour, and my dogs look like its there last meal if Im a few hours late.



    Alarm Clock - I have a dent in my alarm clock from hitting the snooze button so many times, If I have get up and go to my computer in my office

    I might as well get dressed :)

    ReplyDelete
  18. Those are all good suggestions. However:



    1) Our lawn is about 10' by about 15', and we get enough rain that I don't need to water it basically ever.

    2) I don't have any pets.

    3) If I'm tired enough not to get up, I'd rather oversleep.



    In other words - none of those help *me*. :)

    ReplyDelete
  19. That's got to be the crazy-coolest integration system i've yet seen ;o)

    ReplyDelete
  20. I think the one that uses lava lamps is slightly cooler, but thanks!

    ReplyDelete
  21. I know it's been a while, but I was just researching a very similar idea recently, and your posts and code sample helped me make my decisions, and get the small side-project done. Thanks!



    I just posted about it on my blog, if you're interested in what I did: http://aaronlerch.blogspot.com/2005/09/x10-ified.html

    ReplyDelete
  22. so at the top you said it was about 125 to make the lights and the system but i would like to know how much the system will sell for because say i made it and then desided to see how much it sells for and if its more then it took to make then i just earned what ever i got extra so how much do you supose it sells for?

    ReplyDelete
  23. Personally, I would pay you about $125 for it, since everything you need to put the system together (except the hardware) is available for free.



    Setting up build systems, on the other hand, would be a fairly lucrative consutling business.

    ReplyDelete
  24. Great post. Thanks for posting the code. In my office, we took the red/yellow/green concept one step further and bought an actual traffic light (~$200). I adapted your code to the latest version of CCTray and hung the traffic light up on the office wall just now. Awesome.

    ReplyDelete
  25. That is fantastic. I'm glad I played a small part. :)

    ReplyDelete
  26. Wow, that is, on one hand, incredibly nerdybut on the other hand, I really, really like it. I generally use a big dry erase board to keep track of builds and whether or not they were successful, but thats not something that can be seen as easily as your lights. In fact, it can get to be a little convoluted with different people marking things on the board and stuff accidentally getting erased. Your light system looks to be much more efficient, and it doesnt sound like it was very hard to set up at all. The price isnt even that bad. I wonder if you could really trick this out, thoughlike forget just a green light for a good build. I want strobes, some blaring music, you knowlets celebrate when the build goes off like it should! For those really annoying builds that seem to take forever to get to compile, maybe some optional confetti could be included.

    ReplyDelete
  27. Check this Agile Lamp out.

    Also at:
    http://gitorious.org/projects/agile-lamp

    and
    http://agileville.myshopify.com/collections/frontpage

    ReplyDelete
  28. What a unique and colorful way to handle the progress of projects. I can’t wait for the source code.

    ReplyDelete