web of things - towards open and sharable networks of embedded devices

Post on 28-Jan-2015

116 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Talk at http://internet-briefing.ch/devkon

TRANSCRIPT

Web of Things - Towards Open and Sharable Networks of Embedded Devices

Internet Developer Summit 7. April 2010Vlad Trifa - ETH Zurich/SAP Research

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Disclaimer

Studied Comp. Sci., Robotics, AI, Neurosciences @ EPFL

M.Sc. thesis @ UCLA, Bio-acoustics & Sensor Networks

Research in Humanoid Robotics @ ATR, Kyoto, Japan

2005-2006

2001-2006

2006-2007

2007-now Ph.D. @ ETH Zurich & SAP Research

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Electronic things are invading us...

‣ Powerful tiny computers‣ Sensors & actuators‣ Web connectivity‣ Cheap‣ Ubiquitous

Translation for hackers:An infinite playground.

YAAAY!

OGC SensorML

Zorro III

Megaco

AMQP

Modbus

Zorro III

OPC-UA

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Problem...

How do we combine heterogeneous devices to create interactive ad-hoc applications?

‣ Tons of different devices: ‣ Capabilities/functions‣ Applications/middlewares‣ Networking protocols

That is, without a PhD in Computer

Science

We need an universal protocol that is:

simple, lightweight, loosely-coupled, scalable, flexible

and hopefully... standard

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Sounds like the Web...

‣ TCP/IP & Web granted, WiFi routers ubiquitous‣ Development of simple Web apps: cheap & quick‣ Integrate real-world data on the Web‣ Get features of the Web for free

Use Web standards to develop applications for networked devices.

HTTP, HTML, XML, JSON, RSS, ATOM, MIME,...

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Social Web

Real-time Web

Programmable WebSemantic Web

Physical Web

Web of Things

WWWWW

RESTful devices

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

The Web of Things in a nutshell

Steps to create a basic Web of Things (v1.0):

1. Connecting things to the Internet (IPv4/IPv6)2. Embedded Web servers 3. Make devices part of the Web (using REST)

‣ Model their function as RESTful resources

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

RESTful SunSPOTs

‣ Properties and functions are RESTful resources

‣ Devices/services become Web resources‣ URI-addressed ‣ Links between them (hateoas)‣ Different representations (content

negotiation)‣ Uniform interface (HTTP verbs, status

codes)

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Sunspots resources modeling

Services on embedded devices are adapted for resource oriented architectures‣ root: www.spotshost.com‣ spots list: www.spotshost.com/sunspots‣ spot #1: www.spotshost.com/sunspots/1‣ sensors list: www.spotshost.com/sunspots/1/sensors‣ LEDs : www.spotshost.com/sunspots/1/actuators/leds‣ LED #1 : www.spotshost.com/sunspots/1/actuators/leds/led1

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Representations

‣ XHTML ideal for browsinghttp://webofthings.com/spots

‣ JSON ideal for parsing (& lightweight for device)

http://webofthings.com/spots.json

‣ XML ideal for business integrationhttp://webofthings.com/spots.xml

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Uniform interface

‣ HTTP verbs‣ GET: current temperature‣ POST: add a timer‣ PUT: turn a device on/off ‣ DELETE: delete a timer on a device

‣ HTTP headers‣ Accept header for MIME types‣ Status codes (200 ok, 401 unauthorized)

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Gateway level integration: Energie Visible

Gateway (IP:10.1.1.5)

Sensors(Ploggs)

Electric appliances

Web / Mobile Interface

GET http://10.1.1.5:8080/energymonitor/ploggs/*

[{

"deviceName": "ComputerAndScreen",

"currentWatts": 50.52,

"KWh": 5.835,

"maxWattage": 100.56

},

"deviceName": "Fridge",

"currentWatts": 86.28.,

"KWh": 4.421,

"maxWattage": 288.92

}, {...}]

D. Guinard and V. Trifa. Towards the web of things: Web mashups for embedded devices. In 2nd Workshop on Mashups, Enterprise Mashups and Lightweight Composition on the Web (MEM 2009), Madrid, Spain, April 2009.

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

OSGi gateway

The era of physicalMashups

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Real-world Web applications

REST

REST

URL

PHP

REST

API

[hCp://www.pachube.com] [hCp://www.webothings.com/energievisible] [hCp://www.clickscript.ch]

JavaScript

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Clickscript

‣ Javascript-based visual mashup editor

‣ Firefox plugin/Web app‣ Based on DOJO/jQuery

www.clickscript.ch

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Clickscript component

csComponentContainer.push({ name : "cs.web.things.switch", description : "switch on or off", inputs : [{name: "IP",type: "cs.type.String"}, {name: "on/off",type: "cs.type.Boolean"}], outputs: [ ], image: "web/things/plogg.png", exec : function(state){ this.setAsync(); var ip = state.inputs.item(0).getValue(); var aurl = "http://"+ip+":8082/EnergieVisible/ploggs/008098e7cb71/status.html"; var onoff = state.inputs.item(1).getValue() ? "on" : "off"; var component = this;

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

jQuery HTTP request

$.ajax({ url: aurl, type: "PUT", data: ({status : onoff}), success: function(html){ alert("status of Plogg : " +onoff); component.finishAsync(); }, error: function(msg){ alert("Error on: "+aurl); } });

Err, what about eventing & streaming ?

The web wasn’t quite made for that...

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Here comes Real-Time Web

‣ Scalable pub/sub for devices is needed‣ Many solutions (XMPP, etc....)‣ None really integrate with the Web ‣ ATOM/ATOMpub is RESTful, but not push

‣ Push Web technologies ‣ Apply Web PUSH on devices‣ Comet & Web hooks ‣ Bi-directional Web messaging (Websockets)

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Data streams

‣ Sensor data represented as Web streams‣ Publish/subscribe paradigm ‣ Users can create and subscribe to streams ‣ Parameterized‣ devices‣ sensors‣ filter data‣ sampling frequency

‣ Using REST...

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Messaging implementation

‣ Messages transported in JSON‣ Message broker as an external entity (outsourced)‣ Swappable‣ Scalable‣ Currently use RabbitMQ

‣ Web integration with pubsubhubbub‣ RESTful, Web-hook based pub/sub‣ Support for CometD for Web push

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Messaging

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Request

POST example.org/datastreams/ HTTP/1.1 Content-Type: application/x-www-form-urlencoded devices=purpleSensor & data=temperature,light & frequency=2 & filter=light < 200 && temperature > 19

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Response

HTTP/1.1 201 [...] Content-Location: http://example.com:8085/datastreams/bh_0 [...] Connection: close

curl -vd "hub.mode=subscribe&hub.callback=http://example.com:8888/client_callback_handler&hub.topic=&hub.verify=sync" http://example.com:8085/datastreams/bh_0

‣ Then we just subscribe to it:

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Messaging JS solution

‣ jQuery - allows HTTP requests from Javascript‣ reversehttp - allows passing HTTP requests to client

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

function registerDatastream(devices, dataFields, frequency, filter) { var formData = "devices=" + devices + "&data=" + dataFields; if (frequency != "") { formData += "&frequency=" + frequency; } if (filter != "") { formData += "&filter=" + filter; } $.ajax( { type : "POST", url : “http://example.com:8085/datastreams", data : formData, success : function(msg, textStatus, xhr) { if (xhr.status != 201) { alert("Error creating datastream: " + xhr.statusText); } else { queueURL = msg; } }, dataType : "text" }); }

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

function startServerList() { virtualHost = "vh" + Math.round(Math.random() * 100000);

new HttpServer(virtualHost, function(req) { if (req.method == "get") { // subscription verification request [...] } else { // normal message (HTTP POST) var msg = JSON.parse(req.body); var light = msg.data[0].light; var temp = msg.data[0].temp; alert(“Current light level: “ + light); req.respond(200, "OK", {}, ""); } }); }

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Device Discovery

‣ Idea: all device pages contain semantic metadata ‣ Like the header metadata for web robots‣ Machine-readable user manual‣ Human-readable documentation

‣ Proposed solution: microformats for devices‣ What resources are available?‣ What are their input/output?‣ What methods are accepted?‣ Keywords?‣ Eventing channels? ‣ Maybe documentation?

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

<span class="service"> <span class="mftitle">Label: </span><span class="label"></span><br/> <span class="mftitle">Data Format: </span><span class="data-format">Integer</span><br/> <span class="mftitle">Operation: </span><span class="operation"><br/> <span class="mftitle">Method: </span><span class="method">POST</span><br/> <span class="mftitle">Address: </span><span class="address">http://spotmanager:8081/sunspots/Core2TestSpot/actuators/leds/led1</span><br/> <span class="mftitle">Input: </span><span class="input">Red</span><br/> <span class="mftitle">Output: </span><span class="output">The updated Resource</span><br/></span>

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

Take away notes

‣ It’s time for devices to join the Web‣ Huge opportunities ahead for WoT‣ The Web of Things is hard because ‣ People are good Web developers, xor‣ Good embedded systems developers

‣ Tools & best practices for Web-enabled things are needed‣ Tradeoff between performance and features‣ Web developers need to apply their skills and

expertise to build a programmable world‣ We need applications (deployments)

Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich

More!!!

‣ Some docs: http://www.webofthings.com/sxsw‣ Play: http://tinyurl.com/sliderswot‣ Slides: http://www.webofthings.com/talks/idd.pdf

‣ Demos:‣ Browsing the spot manager‣ Poster with content negotiation‣ Javascript app to change LEDs colors‣ Blink & curl!

Thanks for your attention !

ありがとうございました!

Vlad Trifatrifa@inf.ethz.ch

http://www.webofthings.com

top related