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

@ -27,6 +27,8 @@ export declare enum AlexaInterfaceType {
DOORBELL_EVENT_SOURCE = "Alexa.DoorbellEventSource",
ENDPOINT_HEALTH = "Alexa.EndpointHealth",
EQUALIZER_CONTROLLER = "Alexa.EqualizerController",
/** Since 2.0. */
HUMIDITY_SENSOR = "Alexa.HumiditySensor",
INPUT_CONTROLLER = "Alexa.InputController",
INVENTORY_LEVEL_SENSOR = "Alexa.InventoryLevelSensor",
INVENTORY_LEVEL_USAGE_SENSOR = "Alexa.InventoryLevelUsageSensor",

View file

@ -5,7 +5,7 @@ export type { EndpointDefinition, EndpointJson } from "./device/Device.js";
export { Capability } from "./device/Capability.js";
export type { CapabilityJson, CommonOptions, Declaration } from "./device/Capability.js";
export { registry, DeclarationError, SchemaError } from "./registry/index.js";
export { Alexa, BrightnessController, ModeController, RangeController, TemperatureSensor, ToggleController, } from "./registry/index.js";
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerLevelController, RangeController, TemperatureSensor, ToggleController, } from "./registry/index.js";
export { PowerController, EndpointHealth } from "./compat/enums.js";
export { asset, text, semantics, SemanticsBuilder } from "./registry/index.js";
export { ASSETS as Assets, UNITS_OF_MEASURE as Units, ACTIONS as Actions, STATES as States, DISPLAY_CATEGORIES as DisplayCategories, } from "./registry/index.js";

View file

@ -1,8 +1,16 @@
import { Alexa } from "./interfaces/Alexa.js";
import { BrightnessController } from "./interfaces/BrightnessController.js";
import { ColorController } from "./interfaces/ColorController.js";
import { ColorTemperatureController } from "./interfaces/ColorTemperatureController.js";
import { ContactSensor } from "./interfaces/ContactSensor.js";
import { EndpointHealth } from "./interfaces/EndpointHealth.js";
import { HumiditySensor } from "./interfaces/HumiditySensor.js";
import { LockController } from "./interfaces/LockController.js";
import { ModeController } from "./interfaces/ModeController.js";
import { MotionSensor } from "./interfaces/MotionSensor.js";
import { PercentageController } from "./interfaces/PercentageController.js";
import { PowerController } from "./interfaces/PowerController.js";
import { PowerLevelController } from "./interfaces/PowerLevelController.js";
import { RangeController } from "./interfaces/RangeController.js";
import { TemperatureSensor } from "./interfaces/TemperatureSensor.js";
import { ToggleController } from "./interfaces/ToggleController.js";
@ -15,7 +23,7 @@ export declare const registry: {
/** Every descriptor, ordered by namespace. */
list(): AnyDescriptor[];
};
export { Alexa, BrightnessController, EndpointHealth, ModeController, PowerController, RangeController, TemperatureSensor, ToggleController, };
export { Alexa, BrightnessController, ColorController, ColorTemperatureController, ContactSensor, EndpointHealth, HumiditySensor, LockController, ModeController, MotionSensor, PercentageController, PowerController, PowerLevelController, RangeController, TemperatureSensor, ToggleController, };
export type { Mode } from "./interfaces/ModeController.js";
export { asset, text } from "./resources.js";
export { semantics, SemanticsBuilder } from "./semantics.js";

View file

@ -0,0 +1,25 @@
/**
* 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").
*/
export declare const ColorController: import("../types.js").InterfaceDescriptor<{
color: {
name: string;
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
hue: import("../schema.js").Schema<number>;
saturation: import("../schema.js").Schema<number>;
brightness: import("../schema.js").Schema<number>;
}>>;
};
}, {
SetColor: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
color: import("../schema.js").Schema<import("../schema.js").InferShape<{
hue: import("../schema.js").Schema<number>;
saturation: import("../schema.js").Schema<number>;
brightness: import("../schema.js").Schema<number>;
}>>;
}>>;
};
}, {}, false>;

View file

@ -0,0 +1,28 @@
/**
* 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.
*/
export declare const ColorTemperatureController: import("../types.js").InterfaceDescriptor<{
colorTemperatureInKelvin: {
name: string;
value: import("../schema.js").Schema<number>;
};
}, {
SetColorTemperature: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
colorTemperatureInKelvin: import("../schema.js").Schema<number>;
}>>;
};
IncreaseColorTemperature: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{}>>;
note: string;
};
DecreaseColorTemperature: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{}>>;
note: string;
};
}, {}, false>;

View file

@ -0,0 +1,10 @@
/**
* 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).
*/
export declare const ContactSensor: import("../types.js").InterfaceDescriptor<{
detectionState: {
name: string;
value: import("../schema.js").EnumSchema<"DETECTED" | "NOT_DETECTED">;
};
}, {}, {}, false>;

View file

@ -0,0 +1,9 @@
/** The value is an object, { value: 45.5 }, as the reports of alexa-humiditysensor.html print it. */
export declare const HumiditySensor: import("../types.js").InterfaceDescriptor<{
relativeHumidity: {
name: string;
value: import("../schema.js").Schema<import("../schema.js").InferShape<{
value: import("../schema.js").Schema<number>;
}>>;
};
}, {}, {}, false>;

View file

@ -0,0 +1,20 @@
/**
* 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.
*/
export declare const LockController: import("../types.js").InterfaceDescriptor<{
lockState: {
name: string;
value: import("../schema.js").EnumSchema<"LOCKED" | "UNLOCKED" | "JAMMED">;
note: string;
};
}, {
Lock: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{}>>;
};
Unlock: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{}>>;
};
}, {}, false>;

View file

@ -0,0 +1,10 @@
/**
* "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").
*/
export declare const MotionSensor: import("../types.js").InterfaceDescriptor<{
detectionState: {
name: string;
value: import("../schema.js").EnumSchema<"DETECTED" | "NOT_DETECTED">;
};
}, {}, {}, false>;

View file

@ -0,0 +1,23 @@
/**
* 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).
*/
export declare const PercentageController: import("../types.js").InterfaceDescriptor<{
percentage: {
name: string;
value: import("../schema.js").Schema<number>;
};
}, {
SetPercentage: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
percentage: import("../schema.js").Schema<number>;
}>>;
};
AdjustPercentage: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
percentageDelta: import("../schema.js").Schema<number>;
}>>;
};
}, {}, false>;

View file

@ -0,0 +1,20 @@
/** The power of a device as a percentage, a dimmer switch for one (alexa-powerlevelcontroller.html). */
export declare const PowerLevelController: import("../types.js").InterfaceDescriptor<{
powerLevel: {
name: string;
value: import("../schema.js").Schema<number>;
};
}, {
SetPowerLevel: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
powerLevel: import("../schema.js").Schema<number>;
}>>;
};
AdjustPowerLevel: {
name: string;
payload: import("../schema.js").Schema<import("../schema.js").InferShape<{
powerLevelDelta: import("../schema.js").Schema<number>;
}>>;
};
}, {}, false>;