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>
28 lines
882 B
TypeScript
28 lines
882 B
TypeScript
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 }) },
|
|
},
|
|
});
|