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

  • 4,899 views
Uploaded on

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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,899
On Slideshare
0
From Embeds
0
Number of Embeds
23

Actions

Shares
Downloads
349
Comments
0
Likes
14

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Web of Things - Towards Open and Sharable Networks of Embedded Devices Internet Developer Summit 7. April 2010 Vlad Trifa - ETH Zurich/SAP Research
  • 2. Disclaimer 2001-2006 Studied Comp. Sci., Robotics, AI, Neurosciences @ EPFL 2005-2006 M.Sc. thesis @ UCLA, Bio-acoustics & Sensor Networks 2006-2007 Research in Humanoid Robotics @ ATR, Kyoto, Japan 2007-now Ph.D. @ ETH Zurich & SAP Research Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 3. Electronic things are invading us... ‣ Powerful tiny computers ‣ Sensors & actuators ‣ Web connectivity ‣ Cheap ‣ Ubiquitous Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 4. Translation for hackers: An infinite playground. YAAAY!
  • 5. Megaco Modbus OGC SensorML Zorro III AMQP OPC-UA
  • 6. Problem... How do we combine heterogeneous devices to create interactive ad-hoc applications? That is, without a PhD in Computer Science ‣ Tons of different devices: ‣ Capabilities/functions ‣ Applications/middlewares ‣ Networking protocols Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 7. We need an universal protocol that is: simple, lightweight, loosely- coupled, scalable, flexible and hopefully... standard
  • 8. Sounds like the Web... Use Web standards to develop applications for networked devices. HTTP, HTML, XML, JSON, RSS, ATOM, MIME,... ‣ 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 Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 9. WWWWW Social Web Physical Web Real-time Web Semantic Web Programmable Web Web of Things Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 10. RESTful devices
  • 11. 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
  • 12. Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 13. 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
  • 14. 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
  • 15. Representations ‣ XHTML ideal for browsing http://webofthings.com/spots ‣ JSON ideal for parsing (& lightweight for device) http://webofthings.com/spots.json ‣ XML ideal for business integration http://webofthings.com/spots.xml Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 16. 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
  • 17. Gateway level integration: Energie Visible Web / Mobile  Interface GET http://10.1.1.5:8080/energymonitor/ploggs/* [{ Gateway  "deviceName": "ComputerAndScreen", (IP:10.1.1.5) "currentWatts": 50.52, "KWh": 5.835, "maxWattage": 100.56 }, "deviceName": "Fridge", "currentWatts": 86.28., Sensors "KWh": 4.421, (Ploggs) "maxWattage": 288.92 }, {...}] Electric  appliances 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
  • 18. OSGi gateway Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 19. The era of physical Mashups
  • 20. Real-world Web applications REST URL REST I AP Ja va P ST PH Sc RE rip t [hCp://www.pachube.com] [hCp://www.webothings.com/energievisible] [hCp://www.clickscript.ch] Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 21. 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
  • 22. 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
  • 23. 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); } }); Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 24. Err, what about eventing & streaming ? The web wasn’t quite made for that...
  • 25. 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
  • 26. 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
  • 27. 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
  • 28. Messaging Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 29. 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
  • 30. Response HTTP/1.1 201 [...] Content-Location: http://example.com:8085/datastreams/bh_0 [...] Connection: close ‣ Then we just subscribe to it: 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 Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 31. 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
  • 32. 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
  • 33. 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
  • 34. 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
  • 35. <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
  • 36. 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
  • 37. 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! Web of Things, 7.4.2010 Vlad Trifa - SAP/ETH Zurich
  • 38. Thanks for your attention ! Vlad Trifa trifa@inf.ethz.ch http://www.webofthings.com