web of things - towards open and sharable networks of embedded devices
DESCRIPTION
Talk at http://internet-briefing.ch/devkonTRANSCRIPT
![Page 1: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/1.jpg)
Web of Things - Towards Open and Sharable Networks of Embedded Devices
Internet Developer Summit 7. April 2010Vlad Trifa - ETH Zurich/SAP Research
![Page 2: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/2.jpg)
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
![Page 3: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/3.jpg)
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
![Page 4: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/4.jpg)
Translation for hackers:An infinite playground.
YAAAY!
![Page 5: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/5.jpg)
OGC SensorML
Zorro III
Megaco
AMQP
Modbus
Zorro III
OPC-UA
![Page 6: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/6.jpg)
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
![Page 7: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/7.jpg)
We need an universal protocol that is:
simple, lightweight, loosely-coupled, scalable, flexible
and hopefully... standard
![Page 8: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/8.jpg)
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,...
![Page 9: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/9.jpg)
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
![Page 10: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/10.jpg)
RESTful devices
![Page 11: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/11.jpg)
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
![Page 12: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/12.jpg)
Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
![Page 13: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/13.jpg)
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)
![Page 14: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/14.jpg)
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
![Page 15: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/15.jpg)
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
![Page 16: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/16.jpg)
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)
![Page 17: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/17.jpg)
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.
![Page 18: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/18.jpg)
Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
OSGi gateway
![Page 19: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/19.jpg)
The era of physicalMashups
![Page 20: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/20.jpg)
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
![Page 21: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/21.jpg)
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
![Page 22: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/22.jpg)
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;
![Page 23: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/23.jpg)
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); } });
![Page 24: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/24.jpg)
Err, what about eventing & streaming ?
The web wasn’t quite made for that...
![Page 25: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/25.jpg)
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)
![Page 26: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/26.jpg)
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...
![Page 27: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/27.jpg)
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
![Page 28: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/28.jpg)
Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
Messaging
![Page 29: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/29.jpg)
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
![Page 30: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/30.jpg)
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:
![Page 31: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/31.jpg)
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
![Page 32: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/32.jpg)
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" }); }
![Page 33: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/33.jpg)
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", {}, ""); } }); }
![Page 34: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/34.jpg)
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?
![Page 35: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/35.jpg)
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>
![Page 36: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/36.jpg)
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)
![Page 37: Web of Things - Towards Open and Sharable Networks of Embedded Devices](https://reader034.vdocument.in/reader034/viewer/2022050920/54c880884a79598a6b8b462c/html5/thumbnails/37.jpg)
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!