registry: Lock, Color, ColorTemperature, Percentage, PowerLevel, Contact, Motion, Humidity

Eight descriptors written from their pages, each with its version, the value of its property and the payload of
every directive. Seven replace a stub; Alexa.HumiditySensor is new, as AlexaInterfaceType.HUMIDITY_SENSOR.
LockController is deferrable: defer() on a lock logs no warning.

A 1.x declaration of LockController, MotionSensor, PercentageController or PowerLevelController now lists its
property in discovery, where 1.5.2 listed none: the zoo's lock, motion sensor and heater come out as the JSON
Alexa accepted. A payload that does not fit (hue 361, 900 K) is answered with INVALID_VALUE.

48 examples of the eight pages are saved as fixtures. 191 tests pass, 168 before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 20:29:04 +00:00
parent feff828ec1
commit af1489696d
111 changed files with 2971 additions and 45 deletions

View file

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColorController = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
// alexa-property-schemas.html, "Color"
const color = schema_js_1.s.object({
hue: schema_js_1.s.number({ min: 0, max: 360 }),
saturation: schema_js_1.s.number({ min: 0, max: 1 }),
brightness: schema_js_1.s.number({ min: 0, max: 1 }),
});
/**
* A light changes its hue and saturation and keeps the brightness it has: "ignore the brightness value of 1 in the
* directive" (alexa-colorcontroller.html, "SetColor directive example").
*/
exports.ColorController = (0, types_js_1.defineInterface)({
namespace: "Alexa.ColorController",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-colorcontroller.html",
kind: "controller",
tier: 1,
instanced: false,
properties: {
color: { name: "color", value: color },
},
directives: {
SetColor: { name: "SetColor", payload: schema_js_1.s.object({ color }) },
},
});

View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColorTemperatureController = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
// alexa-colortemperaturecontroller.html, "Reportable properties": "Valid values range from 1,000 to 10,000"
const kelvin = schema_js_1.s.number({ min: 1000, max: 10000, integer: true });
/**
* The white of a tunable light. Alexa asks for 2200 (warm), 2700 (soft), 4000 (white), 5500 (daylight) and 7000
* (cool); a light that cannot show the value takes the nearest it can. A light that shows a colour answers
* NOT_SUPPORTED_IN_CURRENT_MODE with currentDeviceMode COLOR.
*/
exports.ColorTemperatureController = (0, types_js_1.defineInterface)({
namespace: "Alexa.ColorTemperatureController",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-colortemperaturecontroller.html",
kind: "controller",
tier: 1,
instanced: false,
properties: {
colorTemperatureInKelvin: { name: "colorTemperatureInKelvin", value: kelvin },
},
directives: {
SetColorTemperature: { name: "SetColorTemperature", payload: schema_js_1.s.object({ colorTemperatureInKelvin: kelvin }) },
IncreaseColorTemperature: { name: "IncreaseColorTemperature", payload: schema_js_1.s.object({}), note: "towards cool" },
DecreaseColorTemperature: { name: "DecreaseColorTemperature", payload: schema_js_1.s.object({}), note: "towards warm" },
},
});

View file

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactSensor = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/**
* DETECTED is open: the two pieces of the sensor are apart. A sensor that cannot answer ReportState sends a
* ChangeReport right after discovery, so that the Alexa app shows its state (alexa-contactsensor.html).
*/
exports.ContactSensor = (0, types_js_1.defineInterface)({
namespace: "Alexa.ContactSensor",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-contactsensor.html",
kind: "sensor",
tier: 1,
instanced: false,
properties: {
detectionState: { name: "detectionState", value: schema_js_1.s.enum("DETECTED", "NOT_DETECTED") },
},
directives: {},
});

View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HumiditySensor = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/** The value is an object, { value: 45.5 }, as the reports of alexa-humiditysensor.html print it. */
exports.HumiditySensor = (0, types_js_1.defineInterface)({
namespace: "Alexa.HumiditySensor",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-humiditysensor.html",
kind: "sensor",
tier: 1,
instanced: false,
properties: {
relativeHumidity: { name: "relativeHumidity", value: schema_js_1.s.object({ value: schema_js_1.s.number({ min: 0, max: 100 }) }) },
},
directives: {},
});

View file

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LockController = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/**
* A lock that takes more than five seconds answers with a DeferredResponse first and the Response when the bolt has
* moved (alexa-lockcontroller.html, "Lock response"). The user enables unlocking by voice per device, in the Alexa app.
*/
exports.LockController = (0, types_js_1.defineInterface)({
namespace: "Alexa.LockController",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-lockcontroller.html",
kind: "controller",
tier: 1,
instanced: false,
properties: {
lockState: {
name: "lockState",
value: schema_js_1.s.enum("LOCKED", "UNLOCKED", "JAMMED"),
note: "JAMMED: the mechanism can reach neither LOCKED nor UNLOCKED",
},
},
directives: {
Lock: { name: "Lock", payload: schema_js_1.s.object({}) },
Unlock: { name: "Unlock", payload: schema_js_1.s.object({}) },
},
deferrable: true,
});

View file

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MotionSensor = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/**
* "When a motion sensor changes to DETECTED, and then changes to NOT_DETECTED, you must wait at least 30 seconds
* before sending the second change report" (alexa-motionsensor.html, "Change reporting").
*/
exports.MotionSensor = (0, types_js_1.defineInterface)({
namespace: "Alexa.MotionSensor",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-motionsensor.html",
kind: "sensor",
tier: 1,
instanced: false,
properties: {
detectionState: { name: "detectionState", value: schema_js_1.s.enum("DETECTED", "NOT_DETECTED") },
},
directives: {},
});

View file

@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PercentageController = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/**
* For a device no other interface fits: "Use this interface only if there isn't a more specific controller
* interface that applies to your device" (alexa-percentagecontroller.html).
*/
exports.PercentageController = (0, types_js_1.defineInterface)({
namespace: "Alexa.PercentageController",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-percentagecontroller.html",
kind: "controller",
tier: 1,
instanced: false,
properties: {
percentage: { name: "percentage", value: schema_js_1.s.number({ min: 0, max: 100, integer: true }) },
},
directives: {
SetPercentage: {
name: "SetPercentage",
payload: schema_js_1.s.object({ percentage: schema_js_1.s.number({ min: 0, max: 100, integer: true }) }),
},
AdjustPercentage: {
name: "AdjustPercentage",
payload: schema_js_1.s.object({ percentageDelta: schema_js_1.s.number({ min: -100, max: 100, integer: true }) }),
},
},
});

View file

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PowerLevelController = void 0;
const schema_js_1 = require("../schema.js");
const types_js_1 = require("../types.js");
/** The power of a device as a percentage, a dimmer switch for one (alexa-powerlevelcontroller.html). */
exports.PowerLevelController = (0, types_js_1.defineInterface)({
namespace: "Alexa.PowerLevelController",
version: "3",
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-powerlevelcontroller.html",
kind: "controller",
tier: 1,
instanced: false,
properties: {
powerLevel: { name: "powerLevel", value: schema_js_1.s.number({ min: 0, max: 100, integer: true }) },
},
directives: {
SetPowerLevel: {
name: "SetPowerLevel",
payload: schema_js_1.s.object({ powerLevel: schema_js_1.s.number({ min: 0, max: 100, integer: true }) }),
},
AdjustPowerLevel: {
name: "AdjustPowerLevel",
payload: schema_js_1.s.object({ powerLevelDelta: schema_js_1.s.number({ min: -100, max: 100, integer: true }) }),
},
},
});

View file

@ -21,11 +21,8 @@ const TABLE = [
["Alexa.Camera.LiveViewController", "1.7", [], LIST_OF_INTERFACES],
["Alexa.CameraStreamController", "3", [], "alexa-camerastreamcontroller.html"],
["Alexa.ChannelController", "3", ["channel"], "alexa-channelcontroller.html"],
["Alexa.ColorController", "3", ["color"], "alexa-colorcontroller.html"],
["Alexa.ColorTemperatureController", "3", ["colorTemperatureInKelvin"], "alexa-colortemperaturecontroller.html"],
["Alexa.Commissionable", "1", [], "alexa-commissionable.html"],
["Alexa.ConsentManagement.ConsentRequiredReporter", "1", [], "alexa-consentrequiredreporter.html"],
["Alexa.ContactSensor", "3", ["detectionState"], "alexa-contactsensor.html"],
["Alexa.Cooking", "1", [], "alexa-cooking.html"],
["Alexa.Cooking.FoodTemperatureController", "1", [], "alexa-cooking-foodtemperaturecontroller.html"],
["Alexa.Cooking.FoodTemperatureSensor", "1", [], "alexa-cooking-foodtemperaturesensor.html"],
@ -44,15 +41,11 @@ const TABLE = [
["Alexa.InventoryUsageSensor", "1", [], "alexa-inventoryusagesensor.html"],
["Alexa.KeypadController", "1", [], "alexa-keypadcontroller.html"],
["Alexa.Launcher", "1.1", [], "alexa-launcher.html"],
["Alexa.LockController", "3", [], "alexa-lockcontroller.html"],
["Alexa.Media.PlayQueue", "1", [], "alexa-media-playqueue.html"],
["Alexa.Media.Playback", "1", [], "alexa-media-playback.html"],
["Alexa.Media.Search", "1", [], "alexa-media-search.html"],
["Alexa.MotionSensor", "3", [], "alexa-motionsensor.html"],
["Alexa.PercentageController", "3", [], "alexa-percentagecontroller.html"],
["Alexa.PlaybackController", "3", [], "alexa-playbackcontroller.html"],
["Alexa.PlaybackStateReporter", "1", [], "alexa-playbackcontroller.html"],
["Alexa.PowerLevelController", "3", [], "alexa-powerlevelcontroller.html"],
["Alexa.ProactiveNotificationSource", "1", [], "alexa-proactivenotificationsource.html"],
["Alexa.RTCSessionController", "1", [], "alexa-rtcsessioncontroller.html"],
["Alexa.RecordController", "3", [], "alexa-recordcontroller.html"],