19. module.exports = (robot) ->
robot.respond /what’s the temperature?/i, (msg) ->
msg.http("http://mchouse.it/temperature")
.header("Accept", "application/json")
.get() (err, res, body) ->
msg.send JSON.parse(body)
We can supercharge our house with hubot
How
20. In order to ask our temp
to hubot, we need to:
1. sense the temp
2. get the temp on the web
3. build a web API
21. From Hubot, I want to do
the equivalent of:
>: curl http://mchouse.it/temp
What about JSON
22. What protocol do we use
to push our temperature
to our API?
HTTP POST
30. Binary vs REST
“Things” should
interact with our
lives, and all the
technology should
be built to make
them easy to use.
M2M protocols are
ad-hoc, and
researchers and
businesses focus on
low level problems.
31. • “things” exposed
with binary protocol
• publish/subscribe
• topics as the naming
system
• “things” exposed
to the web
• request/response
• URIs as the
naming system
32. MQTT is the state of
art protocol for the
Internet of Things
Mosquitto
Really Small
Message Broker
33. • the base element of the protocol is a topic
• devices and other systems can publish or
subscribe to topics
42. • MQTT broker
• REST interface
• HTTP semantics
• no QoS
• built in node.js
• will support MongoDB,
RabbitMQ and many others.
QEST
REST Server
Redis
MQTT Server
QEST
Data Layer
HTTP Clients MQTT Clients
43. QEST
• retains every message received
: MQTT to REST
curl -H "Accept: txt"
http://qest.me/topics/temp
client.publish("temp", "30");
• every topic has its own URI: /topics/<NAME>
44. QEST
• transform every HTTP PUT received into a
MQTT message
: REST to MQTT
void callback(char* topic, byte*
payload, int length) {
...
}
PubSubClient(server, 1883, callback);
client.subscribe("temp");
curl -X PUT -d '{ "housetemp": 42 }'
-H "Content-Type: application/json"
http://qest.me/topics/temp
• devices can listen directly to MQTT topics
45. Web App
Device
SCL
SDA
AREF
GND
IOREF
RESET
3V3
PWM
PWM
PWM
L
TX
RX
ON
ICSP
PWM
PWM
PWM
TX
RX
3
1
2
1
1
1
0
1
9 8
DIGITAL
7 6 5 4 3 2 1 0
1
5V Gnd
POWER
www.arduino.cc
ANALOG IN
Vin 0 1 2 3 4 5
Arduino UNO
IoT
Broker
QEST
state-of-art
approach to IoT apps
QEST-based
solution to IoT apps
Bridge
Web App
Device
SCL
SDA
AREF
GND
IOREF
RESET
3V3
PWM
PWM
PWM
L
TX
RX
ON
ICSP
PWM
PWM
PWM
TX
RX
3
1
2
1
1
1
0
1
9 8
DIGITAL
7 6 5 4 3 2 1 0
1
5V Gnd
POWER
www.arduino.cc
ANALOG IN
Vin 0 1 2 3 4 5
Arduino UNO
47. • What devices can a user monitor?
• What devices can 'listen' to the
state of other devices?
• Who can access the devices state?
• Is the communication secure?
Security Issues