Skip to content

Instantly share code, notes, and snippets.

@joshco
Created October 16, 2023 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshco/cdf86fbef06e6f823a774903f1595ce8 to your computer and use it in GitHub Desktop.
Save joshco/cdf86fbef06e6f823a774903f1595ce8 to your computer and use it in GitHub Desktop.
Coffee machine TD from wot.py
{
"description": "A smart coffee machine with a range of capabilities.\nA complementary tutorial is available at http://www.thingweb.io/smart-coffee-machine.html.",
"actions": {
"makeDrink": {
"description": "Make a drink from available list of beverages. Accepts drink id, size and quantity as input.\nBrews one medium americano if no input is specified.",
"output": {
"description": "Returns True/false and a message when all invoked promises are resolved (asynchronous).",
"properties": {
"result": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"type": "object"
},
"input": {
"properties": {
"drinkId": {
"description": "Defines what drink to make, drinkId is one of possibleDrinks property values, e.g. latte.",
"type": "string"
},
"size": {
"description": "Defines the size of a drink, s = small, m = medium, l = large.",
"type": "string",
"enum": [
"s",
"m",
"l"
]
},
"quantity": {
"description": "Defines how many drinks to make, ranging from 1 to 5.",
"type": "integer",
"minimum": 1,
"maximum": 5
}
},
"type": "object"
},
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/action/makedrink",
"op": [
"invokeaction"
],
"contentType": "application/json"
}
]
},
"setSchedule": {
"description": "Add a scheduled task to the schedules property. Accepts drink id, size, quantity, time and mode as body of a request.\nAssumes one medium americano if not specified, but time and mode are mandatory fields.",
"output": {
"description": "Returns True/false and a message when all invoked promises are resolved (asynchronous).",
"properties": {
"result": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"type": "object"
},
"input": {
"properties": {
"drinkId": {
"description": "Defines what drink to make, drinkId is one of possibleDrinks property values, e.g. latte.",
"type": "string"
},
"size": {
"description": "Defines the size of a drink, s = small, m = medium, l = large.",
"type": "string",
"enum": [
"s",
"m",
"l"
]
},
"quantity": {
"description": "Defines how many drinks to make, ranging from 1 to 5.",
"type": "integer",
"minimum": 1,
"maximum": 5
},
"time": {
"description": "Defines the time of the scheduled task in 24h format, e.g. 10:00 or 21:00.",
"type": "string"
},
"mode": {
"description": "Defines the mode of the scheduled task, e.g. once or everyday. All the possible values are given in the enum field of this Thing Description.",
"type": "string",
"enum": [
"once",
"everyday",
"everyMo",
"everyTu",
"everyWe",
"everyTh",
"everyFr",
"everySat",
"everySun"
]
}
},
"type": "object",
"required": [
"time",
"mode"
]
},
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/action/setschedule",
"op": [
"invokeaction"
],
"contentType": "application/json"
}
]
}
},
"support": "git://github.com/eclipse/thingweb.node-wot.git",
"title": "Smart-Coffee-Machine",
"id": "urn:dev:wot:example:coffee-machine",
"properties": {
"allAvailableResources": {
"description": "Current level of all available resources given as an integer percentage for each particular resource.\nThe data is obtained from the machine's sensors but can be set manually in case the sensors are broken.",
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/allavailableresources",
"op": [
"readproperty",
"writeproperty"
],
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/allavailableresources/subscription",
"op": [
"observeproperty"
],
"contentType": "application/json"
}
],
"properties": {
"water": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"milk": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"chocolate": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"coffeeBeans": {
"type": "integer",
"minimum": 0,
"maximum": 100
}
},
"type": "object"
},
"possibleDrinks": {
"description": "The list of possible drinks in general. Doesn't depend on the available resources.",
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/possibledrinks",
"op": [
"readproperty",
"writeproperty"
],
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/possibledrinks/subscription",
"op": [
"observeproperty"
],
"contentType": "application/json"
}
],
"items": {
"type": "string"
},
"type": "array"
},
"servedCounter": {
"description": "The total number of served beverages.",
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/servedcounter",
"op": [
"readproperty",
"writeproperty"
],
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/servedcounter/subscription",
"op": [
"observeproperty"
],
"contentType": "application/json"
}
],
"type": "integer",
"minimum": 0
},
"maintenanceNeeded": {
"observable": true,
"description": "Shows whether a maintenance is needed. The property is observable. Automatically set to True when the servedCounter property exceeds 1000.",
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/maintenanceneeded",
"op": [
"readproperty",
"writeproperty"
],
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/maintenanceneeded/subscription",
"op": [
"observeproperty"
],
"contentType": "application/json"
}
],
"type": "boolean"
},
"schedules": {
"description": "The list of scheduled tasks.",
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/schedules",
"op": [
"readproperty",
"writeproperty"
],
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/property/schedules/subscription",
"op": [
"observeproperty"
],
"contentType": "application/json"
}
],
"items": {
"properties": {
"drinkId": {
"description": "Defines what drink to make, drinkId is one of possibleDrinks property values, e.g. latte.",
"type": "string"
},
"size": {
"description": "Defines the size of a drink, s = small, m = medium, l = large.",
"type": "string",
"enum": [
"s",
"m",
"l"
]
},
"quantity": {
"description": "Defines how many drinks to make, ranging from 1 to 5.",
"type": "integer",
"minimum": 1,
"maximum": 5
},
"time": {
"description": "Defines the time of the scheduled task in 24h format, e.g. 10:00 or 21:00.",
"type": "string"
},
"mode": {
"description": "Defines the mode of the scheduled task, e.g. once or everyday. All the possible values are given in the enum field of this Thing Description.",
"type": "string",
"enum": [
"once",
"everyday",
"everyMo",
"everyTu",
"everyWe",
"everyTh",
"everyFr",
"everySat",
"everySun"
]
}
},
"type": "object"
},
"type": "array"
}
},
"links": [],
"events": {
"outOfResource": {
"description": "Out of resource event. Emitted when the available resource level is not sufficient for a desired drink.",
"data": {
"type": "string"
},
"forms": [
{
"href": "ws://046875fea30e:9393/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca",
"contentType": "application/json"
},
{
"href": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca/event/outofresource/subscription",
"op": [
"subscribeevent"
],
"contentType": "application/json"
}
]
}
},
"security": [
{
"scheme": "nosec"
}
],
"base": "http://046875fea30e:9494/smart-coffee-machine-97e83de1-f5c9-a4a0-23b6-be918d3a22ca"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment