### Install virtual-thing Source: https://github.com/w3c/wot/blob/main/workshop/ws2/demos-2019-Munich/tools/virtual-thing/readme.md Install the virtual-thing tool globally using npm. ```bash npm install -g virtual-thing ``` -------------------------------- ### Lookup resources in Resource Directory (CoAP) Source: https://context7.com/w3c/wot/llms.txt Use the coap-client to perform a GET request to a Resource Directory to find resources matching specific types, such as 'wot.thing'. ```bash coap-client -m GET "coap://rd.example.com/rd-lookup?rt=wot.thing" ``` -------------------------------- ### Parsing Thing Descriptions with node-wot Source: https://github.com/w3c/wot/blob/main/minutes/plugfest/20251112/Readme.md Demonstrates how to use node-wot to parse a Thing Description (TD) JSON, extract properties, actions, and events, and potentially generate a UI. Requires node-wot to be installed. ```javascript We used node-wot. node-wot lets us parse the json out, we can see the properties, actions and events. For example, I could go to the camera. Josh activates some devices. It basically taking the TD, parses it, the TD has enough metadata, that we can take all of them and generate this UI. ``` -------------------------------- ### Consuming a Thing (Client-side WoT Scripting API) Source: https://context7.com/w3c/wot/llms.txt This JavaScript code demonstrates how to consume a Thing using the WoT Scripting API. It requires the '@node-wot/core' and '@node-wot/binding-http' packages. Ensure the Servient is started and an HttpClientFactory is added before fetching and interacting with a Thing Description. ```javascript const WoT = require("@node-wot/core"); const HttpClientFactory = require("@node-wot/binding-http").HttpClientFactory; const servient = new WoT.Servient(); servient.addClientFactory(new HttpClientFactory()); servient.start().then(async (WoTHelpers) => { try { // Fetch and consume a Thing Description const td = await WoTHelpers.fetch("https://example.com/things/lamp"); const thing = await WoTHelpers.consume(td); // Read a property const status = await thing.readProperty("status"); console.log("Lamp status:", await status.value()); // Write a property await thing.writeProperty("brightness", 75); // Invoke an action const result = await thing.invokeAction("toggle"); console.log("Toggle result:", await result.value()); // Subscribe to an event thing.subscribeEvent("stateChanged", async (data) => { console.log("State changed:", await data.value()); }); // Observe property changes thing.observeProperty("temperature", async (data) => { console.log("Temperature:", await data.value()); }); } catch (error) { console.error("Error:", error); } }); ``` -------------------------------- ### HTML Template Link Source: https://github.com/w3c/wot/blob/main/PRESENTATIONS/2022-04-26-WoT-Sustainability-McCool/Templates/Overview.html This is a link to an example HTML template file that can be used as a starting point for creating slides. It is located in the W3C Talks repository. ```HTML [Overview.html](https://www.w3.org/2022/Talks/ac-slides/Templates/Overview.html) ``` -------------------------------- ### Run virtual-thing Source: https://github.com/w3c/wot/blob/main/workshop/ws2/demos-2019-Munich/tools/virtual-thing/readme.md Execute the virtual-thing tool and view its help message. ```bash virtual-thing --help ``` -------------------------------- ### Example Thing Description for Aqara Sensor Source: https://github.com/w3c/wot/blob/main/minutes/td/20251203/Readme.md This is an example of a Thing Description (TD) for an Aqara Sensor, demonstrating how devices can be described for use with Web of Things standards. It is referenced from the UA-EdgeTranslator samples. ```json { "@context": [ "https://www.w3.org/2022/wot/td/v1.1/context.jsonld", { "@vocab": "https://www.w3.org/wot/core#" } ], "@type": "Thing", "name": "Aqara Sensor P2", "description": "An Aqara P2 sensor that supports Matter.", "securityDefinitions": { "bearer_token_basic": { "scheme": "bearer", "in": "header" } }, "security": "bearer_token_basic", "properties": { "batteryLevel": { "type": "number", "description": "The battery level of the device.", "unit": "percent", "readOnly": true, "observable": true }, "temperature": { "type": "number", "description": "The temperature measured by the device.", "unit": "degree Celsius", "readOnly": true, "observable": true }, "humidity": { "type": "number", "description": "The humidity measured by the device.", "unit": "percent", "readOnly": true, "observable": true } }, "actions": {}, "events": {}, "links": [ { "href": "http://localhost:8080/v1/AqaraSensorP2/", "rel": "item", "mediaType": "application/json" } ] } ``` -------------------------------- ### Convert Device Model to Thing Description Source: https://github.com/w3c/wot/blob/main/workshop/ws2/Demos/tools/Oracle/README.md Use this command to convert a device model JSON file to a Thing Description. Provide the device model file, IoT CSS server address, application ID, and device ID. The -v flag enables verbose output. ```bash node dm2td.js [-v] ``` ```bash node dm2td.js Blue_Pump.json 129.150.200.242 0-AB F68452F4-E498-4A15-BB14-E0DB0E0539DB ``` -------------------------------- ### Animated Text Growth Source: https://github.com/w3c/wot/blob/main/PRESENTATIONS/2022-04-26-WoT-Sustainability-McCool/Templates/Overview.html Use the 'grow' class to animate text, making it appear slowly, start small, and grow to its normal size over a few seconds. ```html

See? ``` -------------------------------- ### WoT Discovery - List All Things with Pagination Source: https://context7.com/w3c/wot/llms.txt Lists all registered Things in the TDD with support for pagination using offset and limit parameters. Requires Authorization header. ```bash # List all Things with pagination curl "https://tdd.example.com/things?offset=0&limit=10" \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### Self-discovery using well-known URI (CoAP multicast) Source: https://context7.com/w3c/wot/llms.txt Perform a CoAP multicast GET request to the well-known URI '/.well-known/core' to discover resources, filtering for 'wot.thing'. ```bash coap-client -m GET "coap://[ff02::fd]/.well-known/core?rt=wot.thing" ``` -------------------------------- ### Discovery via DNS-SD Source: https://context7.com/w3c/wot/llms.txt Utilize the 'dns-sd' command-line tool to browse for services of type '_wot._tcp' in the local network. ```bash dns-sd -B _wot._tcp local. ``` -------------------------------- ### EXI for JSON Test Environment Source: https://github.com/w3c/wot/blob/main/minutes/main/20251114/Readme.md Provides a test environment for EXI for JSON, allowing users to process JSON data using EXI. It includes options for string sharing to further optimize compression. ```link -> Test environment, https://exificient.github.io/javascript/demo/processJSON.html or with string sharing, see https://exificient.github.io/javascript/demo/processJSON.html?SharedStrings=true ```