HomeAmation (formerly ePhidgetY)

HomeAmation main screen

This post will document the data formats necessary for you to read your data in AppDevPro’s HomeAmation Windows 8, and Windows phone applications.

Background

About 1.5 years ago I wrote my first windows phone application pre Mango. In many ways one of my first development projects, certainly the first in .cs. It worked on my machine and I published it in the marketplace where it can still be found. I was and still am proud that I accomplished my goal of learning how to develop and publish the application. However ePhidgety has little utility for anyone except me. HomeAmation is an attempt to make the application useful to a wider audience, probably mostly Diy nerds, and to improve my development skills and port to Windows 8 as well. I’ve also written a garage door opener, Sezame, running on my phone as well. I hope to integrate Sezame with the current HomeAation as well.

Data format

One thing I leaned, I didn’t care for the lower case in the Xml elements. I also chose a more descriptive class name. ePhidgety used “HomeAutomationData” which I feel was far to inclusive a name for what little data was shared in the XML. In HomeAmation I named it: “SummaryData”

If you create a data logger that outputs XML in the following ‘new’ manner you can read it on your windows phone with HomeAmation. I will attempt how I have accomplished this with a LAMP stack and some Phidgets sensors in a later post. I hope to write a post or two on how to accomplish this with a Raspberry Pi, a netduino and a Parallax Spinnerette who knows maybe an Arduino too. It would be very cool if I can find a couple folks to blog how to create data loggers for HomeAmation with the technology of their choice. I’m already itching to work on a couple other apps I have open in Visual Studio right now. (stay on track jeffa)

XML Data for Current and Summary

Old

   1:

   2: <?xml version="1.0" encoding="UTF-8"?>

   3: <HomeAutomationData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   4:  <recordedMinimumTemperature0>49.98721999999999</recordedMinimumTemperature0>

   5:  <recordedMinimumTime>2012-12-28T09:05:09</recordedMinimumTime>

   6:  <recordedMaximumTemperature0>90.78332</recordedMaximumTemperature0>

   7:  <recordedMaximumTime>2011-07-31T17:22:39</recordedMaximumTime>

   8:  <recordedAverageTemperature0>74.860570084392</recordedAverageTemperature0>

   9:  <thirtyDayMinTemperature0>58.78634000000001</thirtyDayMinTemperature0>

  10:  <thirtyDayMinTime>2013-01-15T07:36:03</thirtyDayMinTime>

  11:  <thirtyDayMaxTemperature0>84.38378</thirtyDayMaxTemperature0>

  12:  <thirtyDayMaxTime>2013-01-21T07:21:32</thirtyDayMaxTime>

  13:  <thirtyDayAvgTemperature0>73.25078219952873</thirtyDayAvgTemperature0>

  14:  <currentTemperature0>75.18470000000002</currentTemperature0>

  15:  <currentTemperature1>70.57387057387058</currentTemperature1>

  16:  <currentMeasuredTime>2013-02-08T14:05:24</currentMeasuredTime>

  17: </HomeAutomationData>

New

   1:

   2: <?xml version="1.0" encoding="UTF-8"?>

   3: <SummaryTemperatureData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   4:  <RecordedMinimumTemperature0>49.98721999999999</RecordedMinimumTemperature0>

   5:  <RecordedMinimumTime>2012-12-28T09:05:09</RecordedMinimumTime>

   6:  <RecordedMaximumTemperature0>90.78332</RecordedMaximumTemperature0>

   7:  <RecordedMaximumTime>2011-07-31T17:22:39</RecordedMaximumTime>

   8:  <RecordedAverageTemperature0>74.86059709149919</RecordedAverageTemperature0>

   9:  <ThirtyDayMinTemperature0>58.78634000000001</ThirtyDayMinTemperature0>

  10:  <ThirtyDayMinTime>2013-01-15T07:36:03</ThirtyDayMinTime>

  11:  <ThirtyDayMaxTemperature0>84.38378</ThirtyDayMaxTemperature0>

  12:  <ThirtyDayMaxTime>2013-01-21T07:21:32</ThirtyDayMaxTime>

  13:  <ThirtyDayAvgTemperature0>73.24843719980632</ThirtyDayAvgTemperature0>

  14:  <CurrentTemperature0>74.38478</CurrentTemperature0>

  15:  <CurrentTemperature1>72.64957264957265</CurrentTemperature1>

  16:  <CurrentMeasuredTime>2013-02-08T12:42:15</CurrentMeasuredTime>

  17: </SummaryTemperatureData>

The json data for the Historical chart

[{“Time”:”2013-02-02 02:35:34″,”Temperature0″:”71.58506″,”Temperature1″:”50.06105006105006″},{“Time”:”2013-02-02 02:36:35″,”Temperature0″:”71.58506″,”Temperature1″:”50.18315018315019″},{“Time”:”2013-02-02 02:37:35″,”Temperature0″:”71.58506″,”Temperature1″:”49.81684981684982″}]

Learning

These link pertain to some great blog posts I read and implemented in the HomeAmation Windows store app and windows phone applications.

I originally wrote ePhidgetY, TheLolFx and other applications is to learn to code, to implement some better if not best practices so I would have a stronger foundation as I progress towards applications that may have a wider circulation beyond we nerds. To that end I’ve implemented some code that may not be useful in these simple applications but helps me learn on a simpler project. I’ve rolled in a much better understanding of MVC and MVVM as well as IOC. The real aha moment in this rewrite was yet another attempt to try to understand

Resources and thanks!

AppBarUtils allowed me to Command bind to ViewModel from Application bar in the phone application.

Coding4Fun toolkit Created the phone about page. c4ftk now includes the GZipWebClient by David Anson. I’m passing a lot of Json. Still have a bit of fiddlein’ to get the headers correct.

Awesome 3 part post by @gillcleeren on MVVM in Windows 8 and so much more. Reading this post really brought home some understanding and growth in my code. I’m starting to get the hang of IOC, and the big ticket for me was learning in my gut how the DataServices worked and how much easier it is to write my data requests. Very cool.

I built a Portable Class Library after reading “Portable MVVM Light – Move Your View Models” by Shayne Boyer the Tattoocoder @spboyer Didn’t get my entire view model in there but I’m on my way with PCL.

A special thanks to Lance McCarthy @lancewmccarthy for sharing some great code examples and some pointers in the XAML for the Telerik chart controls. Check out the Nokia developer blog

Stay tuned for some additional posts on ways to make your own data logger.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.