Home Automation - Endpoints
One of the most important pieces in the Miles Platform, in my opinion, will be the endpoints. In the unofficial dictionary for Miles, we’re defining endpoints as the entity that connects the automation platform with physical components. Consider the blog post on automating lights, in that design, an endpoint would control the relay that switches the light on and off.
For the first stab at defining an endpoint, we decided to look at the Arduino. To be specific, we’re looking at an Arduino Uno with the Ethernet shield. Our goal is to define a core set of capabilities that an endpoint has that can operate over, at minimum, a REST API. From there, an endpoint could define additional capabilities to enhance the features that it offers.
For this example, we’ll take a look at endpoint-arduino, which currently supports the most basic of capabilities, writing to and reading from a pin. The REST API for these calls is defined as follows…
(Side-note, I’m still not happy with the pin mode call)
So, four basic calls. Set the pin mode, set the pin to HIGH, set it to LOW, and retrieve it’s current state. All commands return JSON in the following format…
So what does this returned JSON tell us? Let’s annotate this a bit…
While this definition is a work in progress, I think it’s best if this returned set of data is consistent between both endpoints and their special capabilities.
In discussions with Mark Kropf, he brings up being able to use SPI. I also have an immediate use for the Virtuabotix DHT11 Temperature and Humidity Sensor which, while it offers a very handy and easy to use library, would be difficult/impossible to operate by reading from and writing to individual pins over HTTP communication. This is our next step of development, where Mark has said he’ll be looking at SPI, I’ll be adding an interface to the DHT11.
Let me know what you think of this article on twitter @brianmmcclain or leave a comment below!