MCPcopy Index your code
hub / github.com/WebThingsIO/webthing-node / makeThing

Function makeThing

example/simplest-thing.js:19–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17} = require('webthing');
18
19function makeThing() {
20 const thing = new Thing('urn:dev:ops:my-actuator-1234',
21 'ActuatorExample',
22 ['OnOffSwitch'],
23 'An actuator example that just log');
24
25 thing.addProperty(
26 new Property(thing,
27 'on',
28 new Value(true, (update) => console.log(`change: ${update}`)),
29 {
30 '@type': 'OnOffProperty',
31 title: 'On/Off',
32 type: 'boolean',
33 description: 'Whether the output is changed',
34 }));
35 return thing;
36}
37
38function runServer() {
39 const port = process.argv[2] ? Number(process.argv[2]) : 8888;

Callers 1

runServerFunction · 0.70

Calls 1

addPropertyMethod · 0.95

Tested by

no test coverage detected