registry: RangeController, ModeController, ToggleController with resources, presets and semantics
The three generic controllers are described in full and leave the stub table (62 stubs remain). A declaration
takes an instance name, friendly names from text() and asset(), and the options of the interface: range, unit and
presets for a range; supportedModes and ordered for a mode; semantics() for all three, with actions mapped to
directives and states mapped to a value or a range of values.
Refused at device.add(), each with the endpoint, interface and instance in the message: no instance name or no
friendly name; an instance declared twice; a first friendly name or a phrase used by another capability of the
endpoint; a reserved word, an asset id that is not in the catalog; range.max not above range.min; a preset off the
precision grid or outside the range; fewer than two modes or a mode listed twice; a mapping to a directive the
interface does not have, to a payload that does not fit, to a mode that is not listed, to AdjustMode on modes
that are not ordered; SetEcoOn, SetEcoOff, EcoOn and EcoOff on anything but a toggle.
For 1.x callers: Alexa.RangeController lists rangeValue (1.5.2 sent supported: []); addSupportedModes() announces
a mode given as a string as { value } and notes it, and takes { ordered: false } as a second argument, the default
stays true as 1.5.2 sent it (device.add() defaults to false). Declared the 1.x way, the zoo fan and curtain give
the same JSON as before.
Tests: the zoo blind, whose range, unit and semantics were written by hand into the JSON of 1.5.2, is declared
with device.add() and equals that JSON plus the Alexa capability; five capability objects of Amazon's examples
are reproduced the same way. 27 examples of four pages added. npm test: 108 pass (was 85) in 10.5-11.3 s, also on
Node 18.20.8 and 20.20.2.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
c492ef74d1
commit
2558e21787
80 changed files with 3131 additions and 107 deletions
17
dist/cjs/registry/index.js
vendored
17
dist/cjs/registry/index.js
vendored
|
|
@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SchemaError = exports.s = exports.defineInterface = exports.DeclarationError = exports.TemperatureSensor = exports.PowerController = exports.EndpointHealth = exports.BrightnessController = exports.Alexa = exports.registry = void 0;
|
||||
exports.SchemaError = exports.s = exports.defineInterface = exports.DeclarationError = exports.SemanticsBuilder = exports.semantics = exports.text = exports.asset = exports.ToggleController = exports.TemperatureSensor = exports.RangeController = exports.PowerController = exports.ModeController = exports.EndpointHealth = exports.BrightnessController = exports.Alexa = exports.registry = void 0;
|
||||
// The interfaces the library knows, by namespace.
|
||||
const Alexa_js_1 = require("./interfaces/Alexa.js");
|
||||
Object.defineProperty(exports, "Alexa", { enumerable: true, get: function () { return Alexa_js_1.Alexa; } });
|
||||
|
|
@ -22,18 +22,27 @@ const BrightnessController_js_1 = require("./interfaces/BrightnessController.js"
|
|||
Object.defineProperty(exports, "BrightnessController", { enumerable: true, get: function () { return BrightnessController_js_1.BrightnessController; } });
|
||||
const EndpointHealth_js_1 = require("./interfaces/EndpointHealth.js");
|
||||
Object.defineProperty(exports, "EndpointHealth", { enumerable: true, get: function () { return EndpointHealth_js_1.EndpointHealth; } });
|
||||
const ModeController_js_1 = require("./interfaces/ModeController.js");
|
||||
Object.defineProperty(exports, "ModeController", { enumerable: true, get: function () { return ModeController_js_1.ModeController; } });
|
||||
const PowerController_js_1 = require("./interfaces/PowerController.js");
|
||||
Object.defineProperty(exports, "PowerController", { enumerable: true, get: function () { return PowerController_js_1.PowerController; } });
|
||||
const RangeController_js_1 = require("./interfaces/RangeController.js");
|
||||
Object.defineProperty(exports, "RangeController", { enumerable: true, get: function () { return RangeController_js_1.RangeController; } });
|
||||
const TemperatureSensor_js_1 = require("./interfaces/TemperatureSensor.js");
|
||||
Object.defineProperty(exports, "TemperatureSensor", { enumerable: true, get: function () { return TemperatureSensor_js_1.TemperatureSensor; } });
|
||||
const ToggleController_js_1 = require("./interfaces/ToggleController.js");
|
||||
Object.defineProperty(exports, "ToggleController", { enumerable: true, get: function () { return ToggleController_js_1.ToggleController; } });
|
||||
const stubs_js_1 = require("./interfaces/stubs.js");
|
||||
const types_js_1 = require("./types.js");
|
||||
const described = [
|
||||
Alexa_js_1.Alexa,
|
||||
BrightnessController_js_1.BrightnessController,
|
||||
EndpointHealth_js_1.EndpointHealth,
|
||||
ModeController_js_1.ModeController,
|
||||
PowerController_js_1.PowerController,
|
||||
RangeController_js_1.RangeController,
|
||||
TemperatureSensor_js_1.TemperatureSensor,
|
||||
ToggleController_js_1.ToggleController,
|
||||
];
|
||||
const descriptors = new Map();
|
||||
for (const descriptor of [...described, ...stubs_js_1.STUBS]) {
|
||||
|
|
@ -59,6 +68,12 @@ exports.registry = {
|
|||
return [...descriptors.values()].sort((a, b) => (a.namespace < b.namespace ? -1 : 1));
|
||||
},
|
||||
};
|
||||
var resources_js_1 = require("./resources.js");
|
||||
Object.defineProperty(exports, "asset", { enumerable: true, get: function () { return resources_js_1.asset; } });
|
||||
Object.defineProperty(exports, "text", { enumerable: true, get: function () { return resources_js_1.text; } });
|
||||
var semantics_js_1 = require("./semantics.js");
|
||||
Object.defineProperty(exports, "semantics", { enumerable: true, get: function () { return semantics_js_1.semantics; } });
|
||||
Object.defineProperty(exports, "SemanticsBuilder", { enumerable: true, get: function () { return semantics_js_1.SemanticsBuilder; } });
|
||||
var types_js_2 = require("./types.js");
|
||||
Object.defineProperty(exports, "DeclarationError", { enumerable: true, get: function () { return types_js_2.DeclarationError; } });
|
||||
Object.defineProperty(exports, "defineInterface", { enumerable: true, get: function () { return types_js_2.defineInterface; } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue