Web of Things

distilled

23.03.2023 @ 2nd bxEVENT


by Thomas Jäckle (@thjaeckle)

Evolution of devices


Evolution
Device 1.0
Device 2.0
Device 3.0
Device 4.0

What is the WoT?


WoT

Web of Things

  • WoT is a working group at the W3C
  • the W3C
    • was founded by Tim Berners-Lee, inventor of the WWW
    • established standards like:
      HTML, CSS, SOAP, XML, RDF, JSON-LD, ..
  • seeks to counter the fragmentation of the IoT by using and extending existing, standardized Web technologies
tado SRT

"reveal your capabilities"

fairy


sure, here you are ..

  • my properties are ..
  • you can invoke actions ..
  • I emit following events ..

examples

properties

{ // ...
  "properties": {
    "on": {
        "type": "boolean",
        "forms": [{
          "op": "writeproperty",
          "href": "https://myt.example.com:5683/temp",
          "contentType": "application/json",
          "htv:methodName": "POST"
        }]
    },
    "status": {
      "type": "object",
      "properties": {
        "brightness": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 100.0
        },
        "rgb": {
          "type": "array", // ...
        }
      },
      "required": ["brightness", "rgb"],
      "forms": [...]
    }
  }, // ...
}

actions

{ // ...
  "actions": {
    "fade": {
      "title": "Fade in/out",
      "description": "Smooth fade in and out.",
      "input": {
        "type": "object",
        "properties": {
          "from": {
              "type": "integer",
              "minimum": 0,"maximum": 100
          },
          "to": {
              "type": "integer",
              "minimum": 0,"maximum": 100
          },
          "duration": {"type": "number"}
        },
        "required": ["to","duration"]
		  },
      "output": {"type": "string"},
      "forms": [{
        "op": "invokeaction",
        "href": "https://cam.example.com/api/snapshot",
        "contentType": "application/json",
				"htv:methodName": "POST",
        "response": {
          "contentType": "image/jpeg"
        }
      }]
   	}
  }, // ...
}

WoT +
Digital Twins


heart puzzle

WoT issues

  • WoT assumes that each device can describe its
    • capabilities
    • data formats
    • supported protocols
    • auth* mechanisms
    • endpoints
  • not viable for "simple" devices
  • not viable for existing devices

Solution

Ditto

has you covered - let the device's digital twin provide WoT description

fairy
curl -u ditto:ditto -H 'Accept: application/td+json' \
		'https://ddm-api-dev.beyonnex.org/ditto/api/2/things/io.beyonnex:srt-0815'
{
  @context":["https://www.w3.org/2022/wot/td/v1.1", ...],
  "title":"Smart Room Thermostat",
  "@type":"Thing",
  "id":"urn:io.beyonnex:srt-0815",
  "base":"https://ddm-api-dev.beyonnex.org/ditto/api/2/things/io.beyonnex:srt-0815",
  "version":{"model":"1.0.0","instance":"1.0.0"},
  "links":[{
    "rel":"type",
    "href":"https://some-public.website.org/wot/models/srt-1.0.0.tm.jsonld",
    "type":"application/tm+json"
   },...],
   "security":"oauth2_sc",
   "securityDefinitions":{"oauth2_sc":{"scheme": "oauth2","flow":"code","authorization":"...",...}},
   "forms":[{"op":"readallproperties","href":"/attributes","htv:methodName":"GET","contentType":"application/json"}],
	 "properties": {...},
	 "actions": {...},
	 "events": {...}
  ...
}

Conclusion

WoT is all about improved interoperability

  • of different devices
  • across different vendors
  • between partners
friends