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

@ -9,20 +9,74 @@
// page of the interface. The pages of RangeController and ModeController fold their discovery
// examples away, so they were not saved: the range is taken from an example of the ToggleController
// page, and ModeController has none.
// refused [[directive, payload, message]]: a payload the directive does not take, and the message of the
// INVALID_VALUE that answers it
// unfit [[property, value]]: a value the property does not take
//
// test/registry/descriptors.test.js and test/device/discovery.test.js run the entries. The first one fails for a
// descriptor of tier 1 or 2 that has no entry.
// test/registry/descriptors.test.js, test/device/discovery.test.js and test/dispatch/interfaces.test.js run the
// entries. The first one fails for a descriptor of tier 1 or 2 that has no entry.
const { asset, semantics, text } = require("alex2node");
const reported = { retrievable: true, proactivelyReported: true };
const declared = [{ options: reported, example: "discovery" }];
const inThreeLanguages = (english, spanish, french) => [text(english, "en-US"), text(spanish, "es-MX"), text(french, "fr-CA")];
module.exports = [
{ namespace: "Alexa", page: "alexa-interface", declared: [{ options: {}, example: "discovery" }] },
{ namespace: "Alexa.BrightnessController", page: "alexa-brightnesscontroller", declared: [{ options: reported, example: "discovery" }] },
{
namespace: "Alexa.ColorController",
page: "alexa-colorcontroller",
declared,
refused: [
["SetColor", { color: { hue: 361, saturation: 1, brightness: 1 } }, "payload.color.hue: expected a number from 0 to 360, got 361"],
["SetColor", { color: "red" }, 'payload.color: expected an object with hue, saturation, brightness, got "red"'],
],
unfit: [["color", { hue: 120, saturation: 50, brightness: 1 }], ["color", { hue: 120, saturation: 1 }]],
},
{
namespace: "Alexa.ColorTemperatureController",
page: "alexa-colortemperaturecontroller",
declared,
refused: [
["SetColorTemperature", { colorTemperatureInKelvin: 900 }, "payload.colorTemperatureInKelvin: expected an integer from 1000 to 10000, got 900"],
["IncreaseColorTemperature", "a lot", 'payload: expected an object, got "a lot"'],
],
unfit: [["colorTemperatureInKelvin", 10001], ["colorTemperatureInKelvin", "warm"]],
},
{ namespace: "Alexa.ContactSensor", page: "alexa-contactsensor", declared, unfit: [["detectionState", "OPEN"], ["detectionState", true]] },
{ namespace: "Alexa.EndpointHealth", page: "alexa-endpointhealth", declared: [{ options: reported, example: "discovery" }] },
{ namespace: "Alexa.HumiditySensor", page: "alexa-humiditysensor", declared, unfit: [["relativeHumidity", 45], ["relativeHumidity", { value: 101 }]] },
{
namespace: "Alexa.LockController",
page: "alexa-lockcontroller",
declared,
refused: [["Lock", "now", 'payload: expected an object, got "now"']],
unfit: [["lockState", "OPEN"], ["lockState", "locked"]],
},
{ namespace: "Alexa.ModeController", page: "alexa-modecontroller", declared: [] },
{ namespace: "Alexa.MotionSensor", page: "alexa-motionsensor", declared, unfit: [["detectionState", "MOTION"], ["detectionState", 1]] },
{
namespace: "Alexa.PercentageController",
page: "alexa-percentagecontroller",
declared,
refused: [
["SetPercentage", { percentage: 101 }, "payload.percentage: expected an integer from 0 to 100, got 101"],
["AdjustPercentage", { percentageDelta: 0.5 }, "payload.percentageDelta: expected an integer from -100 to 100, got 0.5"],
],
unfit: [["percentage", -1], ["percentage", 50.5]],
},
{ namespace: "Alexa.PowerController", page: "alexa-powercontroller", declared: [{ options: reported, example: "discovery" }] },
{
namespace: "Alexa.PowerLevelController",
page: "alexa-powerlevelcontroller",
declared,
refused: [
["SetPowerLevel", { powerLevel: "half" }, 'payload.powerLevel: expected an integer from 0 to 100, got "half"'],
["AdjustPowerLevel", {}, "payload.powerLevelDelta: expected an integer from -100 to 100, got nothing"],
],
unfit: [["powerLevel", 101], ["powerLevel", null]],
},
{
namespace: "Alexa.RangeController",
page: "alexa-rangecontroller",