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:
parent
feff828ec1
commit
af1489696d
111 changed files with 2971 additions and 45 deletions
25
dist/esm/registry/interfaces/ColorController.d.ts
vendored
Normal file
25
dist/esm/registry/interfaces/ColorController.d.ts
vendored
Normal 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>;
|
||||
26
dist/esm/registry/interfaces/ColorController.js
vendored
Normal file
26
dist/esm/registry/interfaces/ColorController.js
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../types.js";
|
||||
// alexa-property-schemas.html, "Color"
|
||||
const color = s.object({
|
||||
hue: s.number({ min: 0, max: 360 }),
|
||||
saturation: s.number({ min: 0, max: 1 }),
|
||||
brightness: 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").
|
||||
*/
|
||||
export const ColorController = 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: s.object({ color }) },
|
||||
},
|
||||
});
|
||||
28
dist/esm/registry/interfaces/ColorTemperatureController.d.ts
vendored
Normal file
28
dist/esm/registry/interfaces/ColorTemperatureController.d.ts
vendored
Normal 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>;
|
||||
25
dist/esm/registry/interfaces/ColorTemperatureController.js
vendored
Normal file
25
dist/esm/registry/interfaces/ColorTemperatureController.js
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../types.js";
|
||||
// alexa-colortemperaturecontroller.html, "Reportable properties": "Valid values range from 1,000 to 10,000"
|
||||
const kelvin = 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.
|
||||
*/
|
||||
export const ColorTemperatureController = 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: s.object({ colorTemperatureInKelvin: kelvin }) },
|
||||
IncreaseColorTemperature: { name: "IncreaseColorTemperature", payload: s.object({}), note: "towards cool" },
|
||||
DecreaseColorTemperature: { name: "DecreaseColorTemperature", payload: s.object({}), note: "towards warm" },
|
||||
},
|
||||
});
|
||||
10
dist/esm/registry/interfaces/ContactSensor.d.ts
vendored
Normal file
10
dist/esm/registry/interfaces/ContactSensor.d.ts
vendored
Normal 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>;
|
||||
18
dist/esm/registry/interfaces/ContactSensor.js
vendored
Normal file
18
dist/esm/registry/interfaces/ContactSensor.js
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../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).
|
||||
*/
|
||||
export const ContactSensor = 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: s.enum("DETECTED", "NOT_DETECTED") },
|
||||
},
|
||||
directives: {},
|
||||
});
|
||||
9
dist/esm/registry/interfaces/HumiditySensor.d.ts
vendored
Normal file
9
dist/esm/registry/interfaces/HumiditySensor.d.ts
vendored
Normal 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>;
|
||||
15
dist/esm/registry/interfaces/HumiditySensor.js
vendored
Normal file
15
dist/esm/registry/interfaces/HumiditySensor.js
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../types.js";
|
||||
/** The value is an object, { value: 45.5 }, as the reports of alexa-humiditysensor.html print it. */
|
||||
export const HumiditySensor = 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: s.object({ value: s.number({ min: 0, max: 100 }) }) },
|
||||
},
|
||||
directives: {},
|
||||
});
|
||||
20
dist/esm/registry/interfaces/LockController.d.ts
vendored
Normal file
20
dist/esm/registry/interfaces/LockController.d.ts
vendored
Normal 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>;
|
||||
26
dist/esm/registry/interfaces/LockController.js
vendored
Normal file
26
dist/esm/registry/interfaces/LockController.js
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../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.
|
||||
*/
|
||||
export const LockController = 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: s.enum("LOCKED", "UNLOCKED", "JAMMED"),
|
||||
note: "JAMMED: the mechanism can reach neither LOCKED nor UNLOCKED",
|
||||
},
|
||||
},
|
||||
directives: {
|
||||
Lock: { name: "Lock", payload: s.object({}) },
|
||||
Unlock: { name: "Unlock", payload: s.object({}) },
|
||||
},
|
||||
deferrable: true,
|
||||
});
|
||||
10
dist/esm/registry/interfaces/MotionSensor.d.ts
vendored
Normal file
10
dist/esm/registry/interfaces/MotionSensor.d.ts
vendored
Normal 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>;
|
||||
18
dist/esm/registry/interfaces/MotionSensor.js
vendored
Normal file
18
dist/esm/registry/interfaces/MotionSensor.js
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../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").
|
||||
*/
|
||||
export const MotionSensor = 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: s.enum("DETECTED", "NOT_DETECTED") },
|
||||
},
|
||||
directives: {},
|
||||
});
|
||||
23
dist/esm/registry/interfaces/PercentageController.d.ts
vendored
Normal file
23
dist/esm/registry/interfaces/PercentageController.d.ts
vendored
Normal 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>;
|
||||
27
dist/esm/registry/interfaces/PercentageController.js
vendored
Normal file
27
dist/esm/registry/interfaces/PercentageController.js
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../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).
|
||||
*/
|
||||
export const PercentageController = 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: s.number({ min: 0, max: 100, integer: true }) },
|
||||
},
|
||||
directives: {
|
||||
SetPercentage: {
|
||||
name: "SetPercentage",
|
||||
payload: s.object({ percentage: s.number({ min: 0, max: 100, integer: true }) }),
|
||||
},
|
||||
AdjustPercentage: {
|
||||
name: "AdjustPercentage",
|
||||
payload: s.object({ percentageDelta: s.number({ min: -100, max: 100, integer: true }) }),
|
||||
},
|
||||
},
|
||||
});
|
||||
20
dist/esm/registry/interfaces/PowerLevelController.d.ts
vendored
Normal file
20
dist/esm/registry/interfaces/PowerLevelController.d.ts
vendored
Normal 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>;
|
||||
24
dist/esm/registry/interfaces/PowerLevelController.js
vendored
Normal file
24
dist/esm/registry/interfaces/PowerLevelController.js
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../types.js";
|
||||
/** The power of a device as a percentage, a dimmer switch for one (alexa-powerlevelcontroller.html). */
|
||||
export const PowerLevelController = 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: s.number({ min: 0, max: 100, integer: true }) },
|
||||
},
|
||||
directives: {
|
||||
SetPowerLevel: {
|
||||
name: "SetPowerLevel",
|
||||
payload: s.object({ powerLevel: s.number({ min: 0, max: 100, integer: true }) }),
|
||||
},
|
||||
AdjustPowerLevel: {
|
||||
name: "AdjustPowerLevel",
|
||||
payload: s.object({ powerLevelDelta: s.number({ min: -100, max: 100, integer: true }) }),
|
||||
},
|
||||
},
|
||||
});
|
||||
7
dist/esm/registry/interfaces/stubs.js
vendored
7
dist/esm/registry/interfaces/stubs.js
vendored
|
|
@ -18,11 +18,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"],
|
||||
|
|
@ -41,15 +38,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"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue