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
|
|
@ -131,6 +131,23 @@ test("1.x declarations are announced as 1.5.2 announced them, with the Alexa int
|
|||
}
|
||||
});
|
||||
|
||||
test("1.x declarations of the zoo's lock, motion sensor and heater list their properties, which 1.5.2 left to the caller", () => {
|
||||
const T = AlexaInterfaceType;
|
||||
const declarations = {
|
||||
"zoo-lock": [T.LOCK_CONTROLLER],
|
||||
"zoo-motion": [T.MOTION_SENSOR],
|
||||
"zoo-heater": [T.POWER_CONTROLLER, T.POWER_LEVEL_CONTROLLER],
|
||||
"zoo-color-lamp": [T.POWER_CONTROLLER, T.BRIGHTNESS_CONTROLLER, T.COLOR_CONTROLLER],
|
||||
"zoo-warm-lamp": [T.POWER_CONTROLLER, T.COLOR_TEMPERATURE_CONTROLLER],
|
||||
};
|
||||
for (const [endpointId, types] of Object.entries(declarations)) {
|
||||
const device = likeTheZoo(endpointId);
|
||||
for (const type of types) device.addCapability(type, { proactivelyReported: true });
|
||||
assert.deepEqual(device.getJSON().capabilities, [...zoo(endpointId).capabilities, ALEXA], endpointId);
|
||||
assert.deepEqual(device.check(), [], endpointId);
|
||||
}
|
||||
});
|
||||
|
||||
test("a RangeController blind declared with device.add() is the zoo's blind, whose JSON was written by hand", () => {
|
||||
const blinds = likeTheZoo("zoo-blinds");
|
||||
blinds.add(RangeController, {
|
||||
|
|
@ -329,16 +346,16 @@ test("discovery logs what check() says about the devices, each line once", async
|
|||
const lamp = bridge.registerDevice("Dave's Lamp", "lamp-1", DisplayCategory.LIGHT);
|
||||
lamp.addCapability(AlexaInterfaceType.POWER_CONTROLLER);
|
||||
lamp.addCapability(AlexaInterfaceType.POWER_CONTROLLER);
|
||||
lamp.addCapability(AlexaInterfaceType.LOCK_CONTROLLER);
|
||||
lamp.addCapability(AlexaInterfaceType.KEYPAD_CONTROLLER);
|
||||
bridge.registerDevice("Lamp", "lamp-2", DisplayCategory.LIGHT).addCapability(AlexaInterfaceType.POWER_CONTROLLER);
|
||||
|
||||
// Announced all the same: 1.x announced it, and Alexa may have taken it
|
||||
const [first] = await discover(alexa, "root");
|
||||
assert.deepEqual(names(first), ["Alexa.PowerController", "Alexa.PowerController", "Alexa.LockController", "Alexa"]);
|
||||
assert.deepEqual(names(first), ["Alexa.PowerController", "Alexa.PowerController", "Alexa.KeypadController", "Alexa"]);
|
||||
assert.deepEqual(warnings(), [
|
||||
'warning: lamp-1: the name "Dave\'s Lamp" takes up to 256 letters, digits and spaces, no punctuation',
|
||||
"warning: lamp-1: Alexa.PowerController: the interface is declared twice",
|
||||
"warning: lamp-1: Alexa.LockController: no property list known, discovery lists it with no supported properties",
|
||||
"warning: lamp-1: Alexa.KeypadController: no property list known, discovery lists it with no supported properties",
|
||||
]);
|
||||
|
||||
lamp.setName("Daves Lamp");
|
||||
|
|
|
|||
|
|
@ -295,12 +295,12 @@ test("a phrase is mapped once on an endpoint, across its Range, Mode and Toggle
|
|||
|
||||
test("a stub is declared like any interface and checked for nothing but being declared twice", () => {
|
||||
const lock = endpoint("lock-1", "Front Door", ["SMARTLOCK"]);
|
||||
const capability = lock.add(registry.get("Alexa.LockController"), { proactivelyReported: true });
|
||||
const capability = lock.add(registry.get("Alexa.KeypadController"), { proactivelyReported: true });
|
||||
assert.deepEqual(capability.toJSON(), {
|
||||
type: "AlexaInterface",
|
||||
interface: "Alexa.LockController",
|
||||
version: "3",
|
||||
interface: "Alexa.KeypadController",
|
||||
version: "1",
|
||||
properties: { supported: [], proactivelyReported: true, retrievable: true },
|
||||
});
|
||||
assert.equal(refused(() => lock.add(registry.get("Alexa.LockController"))).message, "lock-1: Alexa.LockController: the interface is declared twice");
|
||||
assert.equal(refused(() => lock.add(registry.get("Alexa.KeypadController"))).message, "lock-1: Alexa.KeypadController: the interface is declared twice");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue