Use Apigee and APIs to secure, and control your home! In our IoT themed developer workshop we'll be building a home security system that will use a combination of JavaScript, Hardware, and APIs. This workshop will give you first hand experience in the world of hardware using Zettajs the Apigee framework for the Internet of Things. You'll model devices, orchestrate interactions, and get an API for free. A strong knowledge of JavaScript, and Node.js is required. You should have node installed on your computer, and a text editor ready to write code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//From | |
{ | |
"topic":"lcd/8142E11C-87AE-4C13-9DD1-E2900EB97BF0", | |
"timestamp":1402676545565, | |
"transition":"change", | |
"input":[{"name":"message", "value":"I heard dat!"}], | |
"properties": { | |
"type":"lcd", | |
"name":"My LCD", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var zetta = require('zetta'); | |
var Scout = zetta.Scout; | |
var HueBulb = require('./hue_bulb_driver'); | |
var HueBulbScout = module.exports = function(){ | |
Scout.call(this); | |
}; | |
util.inherits(HueBulbScout, Scout); |
Hi there!
Today we'll be building a simple app to make Async API calls and parse JSON. Below is a list of requirements for the app.
- Open XCode and create a
Single View Application
- The app must make an asynchronous
GET
HTTP call to the following URLhttp://ug-proxy.herokuapp.com/
- The app must parse the JSON and log out the
name
andaddress
properties from the results of the HTTP call - When complete copy and paste Objective-C into the comments box below.
curl -i http://ug-proxy.herokuapp.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var argo = require('argo'); | |
var cache = require('volos-cache-memory'); | |
var cacheInstance = cache.create('test', {ttl: 10000}); | |
argo() | |
.use(cacheInstance.argoMiddleware().cache()) | |
.get('/hello', function(handle) { | |
handle('request', function(env, next) { | |
env.response.statusCode = 200; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"class":["device"], | |
"properties": { | |
"id":"E2A9E247-1F9C-47B8-9A6B-813AD63F3D58", | |
"name":"Matt's sound sensor", | |
"type":"sound", | |
"state":"ready", | |
"amplitude":10 | |
}, | |
"links":[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var Scout = require('zetta').Scout; | |
var SerialPort = require('serialport').SerialPort; | |
var Microphone = require('./microphone_driver'); | |
var Arduino = module.exports = function(runtime) { | |
Scout.call(this); | |
// allow access to runtime to other methods. | |
this.runtime = runtime; | |
this.portName = '/dev/tty.usbserial'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Driver = require('zetta').Driver; | |
var util = require('util'); | |
// Name your driver the device it's modeling | |
var Microphone = module.exports = function(port){ | |
Driver.call(this); | |
// not saved and not exposed in api | |
this._port = port; | |
// saved and exposed in api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zetta = require('zetta'); | |
var Arduino = require('./scouts/arduino'); | |
var app = zetta(); | |
// app.name() is optional | |
app.expose('*'); | |
app.load(Arduino); | |
app.link('http://zetta-cloud.herokuapp.com/') | |
app.observe([{type: 'sound'}, {type:'lcd'}]function(sound, lcd) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zetta peers add "http://zetta-cloud.herokuapp.com" | |
node app.js |