import { s } from "../schema.js"; import { semanticsOf } from "../semantics.js"; import { defineInterface } from "../types.js"; const directives = { TurnOn: { name: "TurnOn", payload: s.object({}) }, TurnOff: { name: "TurnOff", payload: s.object({}) }, }; /** * Something that is on or off, under an instance name: the oscillation of a fan, the light of an oven. The one * generic controller that Alexa hunches work with (SetEcoOn, SetEcoOff, EcoOn, EcoOff). */ export const ToggleController = defineInterface({ namespace: "Alexa.ToggleController", version: "3", doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-togglecontroller.html", kind: "controller", tier: 1, instanced: true, properties: { toggleState: { name: "toggleState", value: s.enum("ON", "OFF") }, }, directives, options: s.object({ semantics: s.optional(semanticsOf({ directives, stateValue: s.enum("ON", "OFF"), hunches: true })), }, { unknownKeys: "reject" }), errorNamespace: "Alexa.Safety", errorTypes: ["OBSTACLE_DETECTED", "SAFETY_BEAM_BREACHED"], });