Skip to content

Commit

Permalink
Add WebThings TDs and documentation for 2024-11 PlugFest
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrancis committed Nov 22, 2024
1 parent 5d108e9 commit 625d003
Show file tree
Hide file tree
Showing 31 changed files with 3,667 additions and 0 deletions.
30 changes: 30 additions & 0 deletions events/2024.11.Munich/Documentation/WebThings Gateway/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# WebThings Gateway

[WebThings Gateway](https://webthings.io/gateway/) is an open source Web of Things gateway which bridges a range of smart home protocols to the Web of Things.

The Thing Descriptions shared in the TDs folder were generated by an instance of an early preview of WebThings Gateway 2.0 which can be accessed at https://plugfest.webthings.io.

WebThings Gateway 2.0 acts as a Producer of WoT Thing Descriptions and implements:

- WoT Thing Description 1.1
- OAuth2SecurityScheme
- WoT Profiles
- HTTP Basic Profile
- HTTP SSE Profile
- WoT Discovery
- Direct Introduction Mechanism
- Well-Known URIs Introduction Mechanism
- ThingDirectory & Directory Service API
- OAuth2 Security Bootstrapping using WWW-Authenticate headers and Authorization Server Metadata

Note that gateway.td.json is a new top-level Thing Description hosted by the gateway at `/` and `/.well-known/wot` which describes the gateway itself and the features of the Directory Service API it exposes.

The gateway uses HTTP Bearer Authentication via Oauth2. I will provide both a username and password (for the HTML web interface) and a bearer token (for the HTTP API) on the WoT Working Group members mailing list. The Bearer token should be provided in an HTTP `Authorization` header or `jwt` query string in all API requests.

Note that HTTP API requests must also specify an `Accept` header with a value of `application/json` or `application/td+json`, otherwise you will receive an HTML response by default.

User documentation for WebThings Gateway can be found at https://webthings.io/docs/

WebThings Gateway 2.0 uses Node.js 20 and runs on a production quality [Ubuntu Core](https://ubuntu.com/core) base operating system inside [snap](https://snapcraft.io/) containerisation.

Please email [email protected] with any questions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"title": "Virtual Actions & Events Thing",
"@context": [
"https://www.w3.org/2022/wot/td/v1.1",
"https://webthings.io/schemas"
],
"@type": [],
"profile": [
"https://www.w3.org/2022/wot/profile/http-basic/v1",
"https://www.w3.org/2022/wot/profile/http-sse/v1"
],
"description": "",
"href": "/things/virtual-things-10",
"properties": {},
"actions": {
"basic": {
"title": "No Input",
"description": "An action with no inputs, fires an event",
"forms": [
{
"href": "/things/virtual-things-10/actions/basic"
}
]
},
"single": {
"title": "Single Input",
"description": "An action with a single, non-object input",
"input": {
"type": "number"
},
"forms": [
{
"href": "/things/virtual-things-10/actions/single"
}
]
},
"multiple": {
"title": "Multiple Inputs",
"description": "An action with mutiple, optional inputs",
"input": {
"type": "object",
"properties": {
"stringInput": {
"type": "string"
},
"booleanInput": {
"type": "boolean"
}
}
},
"forms": [
{
"href": "/things/virtual-things-10/actions/multiple"
}
]
},
"advanced": {
"title": "Advanced Inputs",
"description": "An action with many inputs, some required",
"input": {
"type": "object",
"required": [
"numberInput"
],
"properties": {
"numberInput": {
"type": "number",
"minimum": 0,
"maximum": 100,
"unit": "percent"
},
"integerInput": {
"type": "integer",
"unit": "metre"
},
"stringInput": {
"type": "string"
},
"booleanInput": {
"type": "boolean"
},
"enumInput": {
"type": "string",
"enum": [
"enum string1",
"enum string2",
"enum string3"
]
}
}
},
"forms": [
{
"href": "/things/virtual-things-10/actions/advanced"
}
]
}
},
"events": {
"virtualEvent": {
"description": "An event from a virtual thing",
"data": {
"type": "number"
},
"forms": [
{
"href": "/things/virtual-things-10/events/virtualEvent",
"subprotocol": "sse"
}
]
}
},
"links": [
{
"rel": "alternate",
"type": "text/html",
"href": "/things/virtual-things-10"
},
{
"rel": "alternate",
"href": "wss://plugfest.webthings.io/things/virtual-things-10"
}
],
"forms": [
{
"href": "/things/virtual-things-10/actions",
"op": "queryallactions"
},
{
"href": "/things/virtual-things-10/events",
"op": [
"subscribeallevents",
"unsubscribeallevents"
],
"subprotocol": "sse"
}
],
"layoutIndex": 0,
"selectedCapability": "Custom",
"iconHref": null,
"groupId": null,
"id": "https://plugfest.webthings.io/things/virtual-things-10",
"base": "https://plugfest.webthings.io/",
"securityDefinitions": {
"oauth2_sc": {
"scheme": "oauth2",
"flow": "code",
"authorization": "https://plugfest.webthings.io/oauth/authorize",
"token": "https://plugfest.webthings.io/oauth/token",
"scopes": [
"/things/virtual-things-10:readwrite",
"/things/virtual-things-10",
"/things:readwrite",
"/things"
]
}
},
"security": "oauth2_sc"
}
112 changes: 112 additions & 0 deletions events/2024.11.Munich/TDs/WebThings Gateway/air-quality-sensor.td.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"title": "Virtual Air Quality Sensor",
"@context": [
"https://www.w3.org/2022/wot/td/v1.1",
"https://webthings.io/schemas"
],
"@type": [
"AirQualitySensor"
],
"profile": [
"https://www.w3.org/2022/wot/profile/http-basic/v1",
"https://www.w3.org/2022/wot/profile/http-sse/v1"
],
"description": "",
"href": "/things/virtual-things-28",
"properties": {
"concentration": {
"name": "concentration",
"value": 20,
"title": "Gas Concentration",
"type": "number",
"@type": "ConcentrationProperty",
"unit": "ppm",
"minimum": 0,
"readOnly": true,
"forms": [
{
"href": "/things/virtual-things-28/properties/concentration"
},
{
"href": "/things/virtual-things-28/properties/concentration",
"op": [
"observeproperty",
"unobserveproperty"
],
"subprotocol": "sse"
}
]
},
"density": {
"name": "density",
"value": 20,
"title": "Particulate Density",
"type": "number",
"@type": "DensityProperty",
"unit": "micrograms per cubic metre",
"minimum": 0,
"readOnly": true,
"forms": [
{
"href": "/things/virtual-things-28/properties/density"
},
{
"href": "/things/virtual-things-28/properties/density",
"op": [
"observeproperty",
"unobserveproperty"
],
"subprotocol": "sse"
}
]
}
},
"actions": {},
"events": {},
"links": [
{
"rel": "alternate",
"type": "text/html",
"href": "/things/virtual-things-28"
},
{
"rel": "alternate",
"href": "wss://plugfest.webthings.io/things/virtual-things-28"
}
],
"forms": [
{
"href": "/things/virtual-things-28/properties",
"op": "readallproperties"
},
{
"href": "/things/virtual-things-28/properties",
"op": [
"observeallproperties",
"unobserveallproperties"
],
"subprotocol": "sse"
}
],
"layoutIndex": 26,
"selectedCapability": "AirQualitySensor",
"iconHref": null,
"groupId": null,
"id": "https://plugfest.webthings.io/things/virtual-things-28",
"base": "https://plugfest.webthings.io/",
"securityDefinitions": {
"oauth2_sc": {
"scheme": "oauth2",
"flow": "code",
"authorization": "https://plugfest.webthings.io/oauth/authorize",
"token": "https://plugfest.webthings.io/oauth/token",
"scopes": [
"/things/virtual-things-28:readwrite",
"/things/virtual-things-28",
"/things:readwrite",
"/things"
]
}
},
"security": "oauth2_sc"
}
Loading

0 comments on commit 625d003

Please sign in to comment.