Philipp Blum
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# W3C Web of Things: The revolution is here The missing interoperability between devices is hindering the development of IoT. An increasing amoung of systems are vendor locked and are not able to talk to each other. In 2014 the W3C took over this challenge and formed the [Web of Things Working Group](https://www.w3.org/WoT/wg/). The same organization which already standardizes HTML, CSS, SVG and other important standards used in the Web today. In April 2020 the [Web of Things Architecture](https://www.w3.org/TR/wot-architecture/) and [Thing Description](https://www.w3.org/TR/wot-thing-description/) became recommended standards by the W3C. The standards are embraced by well known companies in the industry, such as Panasonic, Hitachi, Intel and Siemens. The Web of Things (WoT) doesn’t aim to replace any standard. The WoT standards are the glue to enable interoperability. The best of all: The standards are open and free to use for everyone. Even the process and protocols are transparent and open. The W3C is well known to be vendor neutral. Any organization can join the W3C. This guarantees the maximal adoption possible. ## Let’s take a look into the Web of Things The entry point for the Web of Things is the [Thing Description (TD)](https://www.w3.org/TR/wot-thing-description/). In a way it is similar to the index.html for the World Wide Web. As the name suggests it contains all the metadata and API description of an IoT device. Details of where to get the TD from is described in the [WoT discovery document](https://www.w3.org/TR/wot-discovery/). It is also possible to store WoT TDs of multiple devices in a TD directory. The directory makes it possible to search and filter TDs from multiple devices at once. ## Interaction Affordances The APIs of the device are described in the InteractionAffordances. There are three types of InteractionAffordances in the Thing Description. ActionAffordances are used to describe available functions on the device. This could be the trigger for a sprinkler system or some other functionality. PropertyAffordances expose the state of device. The states can be read and written. EventAffordances describe events. This can be alerts or continues event streams. Overall InteractionAffordances make it possible to describe a wide range of use-cases. The input and output can be defined in the forms of each InteractionAffordance. As well as the API endpoints. ## A practical example Let’s take a practical example of a WoT TD. Given is a simple weather station with its Thing Description. ```json { "id":"urn:dev:weather_sensor-23451", "title":"Weather station", "description":"Weather station with humidity, pressure and temperature", "@context":[ "https://www.w3.org/2019/wot/td/v1" ], "securityDefinitions":{ "nosec_sc":{ "scheme":"nosec" } }, "security":[ "nosec_sc" ], "properties":{ "temperature":{ "type":"object", "properties":{ "temperature":{ "type":"number", "unit":"°C" } }, "title":"Temperature", "forms":[ { "href":"/properties/temperature" } ] }, "humidity":{ "type":"object", "properties":{ "humidity":{ "type":"number", "unit":"%", "minimum":0, "maximum":100 } }, "readOnly":true, "title":"Humidity", "forms":[ { "href":"/properties/humidity" } ] }, "pressure":{ "type":"object", "properties":{ "pressure":{ "type":"number", "unit":"hPa" } }, "readOnly":true, "title":"Pressure", "forms":[ { "href":"/properties/pressure" } ] } }, "base":"coap://[2003:f0:2701:c700:260f:c4ff:feaf:5b8c]" } ``` The base has the prefix `coap:`. Therefore the APIs are available under the CoAP protocol. The device can support multiple protocols if needed. Details about discoverability are defined in the [WoT discovery document](https://www.w3.org/TR/wot-discovery/). This device only has PropertyAffordances defined. They are defined in `properties` property of the JSON object. Let's take a deeper look into the first PropertyAffordance. The PropertyAffordance `temperature` is defined as the following ```json { "temperature":{ "type":"object", "properties":{ "temperature":{ "type":"number", "unit":"°C" } }, "title":"Temperature", "forms":[ { "href":"/properties/temperature" } ] } } ``` The key of the affordance can become important when you consume the TD with a WoT TD library. You can also semantically tag the Property Affordance. One [example](https://www.w3.org/TR/wot-thing-description/#thing-description-full-serialization) mentioned in the WoT TD specification is [saref](https://www.w3.org/2019/09/trans-data-ws/SAREF.pdf). The temperature is available under the URL `coap://[2003:f0:2701:c700:260f:c4ff:feaf:5b8c]/properties/temperature`. `type` indicates what data type is returned. In this case it is an object. The default `contenType` in the form is defined as `application/json` according to the [WoT TD 1.0 §5.4](https://www.w3.org/TR/wot-thing-description11/#sec-default-values). Therefore we are dealing here with JSONs. When another serialization format is used the `contentType` has to be set accordingly. The details of how to interprete it for other serialization format are defined as [Web of Things Binding Templates](https://w3c.github.io/wot-binding-templates/). Since this example uses JSONs the interpretation is pretty straight forward. We have a JSON object with one property called `temperature`. This property contains a number as unit `°C`. When we request the URL we get the following response ``` > ./coap-client -m get coap://[2003:f0:2701:c700:260f:c4ff:feaf:5b8c]/properties/temperature { "temperature": 19.39 } ``` ## Consuming the data When it comes to libraries there are several options. There is an overview of tools and libraries on the website of the [Web of Things Working Group](https://www.w3.org/WoT/developers/). Let's take a short look into the [node-wot](https://github.com/eclipse/thingweb.node-wot) Javascript library. ```javascript const servient = new Servient() servient.addClientFactory(new CoapClientFactory()) const wotHelper = new Helpers(servient) Promise.all( [ wotHelper.fetch("coap:[2003:f0:2701:c700:260f:c4ff:feaf:5b8c]/.well-known/wot-thing-description"), servient.start() ] ).then((values) => { const td = values[0] const WoT = values[1] return WoT.consume(td).then((thing) => { // read the property "temperature" and print the value return thing.readProperty("temperature").then((s) => { console.log(s.value()) }) }); }).catch((err) => { console.error("Fetch error:", err) }) ``` As you can see the Web of Things also reduces the development effort dramatically due to the standardized way of descripting device metadata and APIs. No complicated glueing of different libraries in order to consume the device necessary. Libraries are able to implement a generalized way to handle Thing Descriptions. This also enables to build genalized gateway solutions. Due to the nature of standards generalized software solutions can replace vendor-dependend implementatios. The node-wot library implements the [Web of Thing Scripting API](https://www.w3.org/TR/2020/NOTE-wot-scripting-api-20201124/). The Web of Things Scripting API is designed to get eventually implemented by browser vendors. I hope this gives you a good introduction into the Web of Things. If you want to have more practical examples, you can find a couple of written [tutorials on bind.system](https://bind.systems/tags/web-of-things/).

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully