Forgetting to Water the Christmas Tree? How Personal Clouds Saved Christmas


Summary

A personal clouds with a cloud-based operating system provides an easy way to take water level signals from an Electric Imp to automatically notify a homeowner via SMS that his Christmas tree needs to be watered.

Chad by the tree

Last week at a neighborhood Christmas gathering, Chad Harrington approached me and said "Phil, I've been reading your blog and I've got a problem I think Kynetx can help me with." I immediately had visions of a big deal with Chad's company, but he was talking about something more down to earth: he was forgetting to water his Christmas tree.

Chad is VP of Marketing at Adaptive Computing, but don't let the title fool you—he has a degree in computer engineering. He told me he already had an Electric Imp connected to a Vegetronix Water Sensor using a breakout board. Further, he was able to sense the water level in the stand. But he wanted to receive a text when the water level was below a certain threshold.

The Parts: Vegetronix Water Sensor, Spark Fun Breakout Board & Electric Imp Vegetronix Water Sensor Attached to Tree

Chad knew he could stand up a Web server, figure out the Twilio API, and eventually get it all working. But like any good programmer, he was looking for a shortcut—leverage to save him some time. After all, a solution to the problem on December 26th might have felt good, but it won't keep the tree alive. He rightly saw Kynetx and KRL as the answer to his problem.

We spent five minutes setting up his personal cloud on his iPhone and I showed him how to raise an event into Kynetx from his Electric Imp using the Sky event API. All that is required of the Imp is that it make an HTTP POST to an event signal URL associated with Chad's personal cloud. That done, the only task left was to write a rule to listen for the event and notify Chad that his tree needs attention.

The rule is very simple:

rule notify_for_water {
  select when xmastree need_water
  pre {
    level = event:attr("value") || "unknown";
  }
  always {
    raise notification event status with
      priority = 2 and
      application = meta:rulesetName() and
      subject = "Christmas Tree Water" and
      description = "Your christmas tree needs watering.
                     The water level is #{level}"
  }
}

The preceding rule listens for the xmastree:need_water event. The current level is contained in an event attribute named value. The rule raises a notification:status event with priority 2 and a message containing the water level. I put the rule in the myCloud app store and Chad just installed it in his cloud.

The reason that this rule sends Chad a text is because he's configured his personal cloud to send a text on an Urgent Priority (priority 2) notification. He could easily change the configuration to send him an email or to simply log the level. Here's a screenshot showing my personal cloud's notification settings:

Screen Shot 2012-12-17 at 8.40.46 AM

One of the big wins from a personal cloud is that the cloud OS provides the developer with a lot of leverage as the preceding rule demonstrates. In this case, the operating system takes care of all of the details of notifying the Chad according to his preference. Further, if you install it in your personal cloud, it will notify you according to your preference without the developer having to worry about multi-homing, APIs, configuration, and so on. Everyone gets a personalized experience.

Writing programs for a personal computer is a lot easier with an operating system than without one. In fact, operating systems are what account for the great explosion of useful software that has made the personal computer so valuable to people and organizations.

This is illustrated by the huge advantage Microsoft offered developers when Microsoft added printer drivers to Windows. You may not remember that one of the reasons OS/2 didn't make it was the chronic lack of printer drivers. If the OS doesn't provide printer drivers every program has to supply them individually. The results are inconsistent, many programs simply don't print, and not every printer is supported when they do.

Notification services are the printer driver of the CloudOS. What's more, they're just one of the things a cloud OS can offer to developers. In addition, the OS standardizes and takes care of the application's configuration, user interface, data management, and connections to other clouds. I'll be writing more about each of these in the coming weeks.


Please leave comments using the Hypothes.is sidebar.

Last modified: Wed Feb 12 18:26:32 2020.