Six descriptors written from their pages replace the last stubs of tiers 1 and 2. A scene answers Activate and Deactivate through ctx.respond() with ActivationStarted and DeactivationStarted, the time and the cause filled in. device.raise(descriptor, name, payload) publishes DoorbellPress and the Event of a button on <root>/event with the endpoint and a new messageId; it throws a MessageError for an interface or instance the device did not declare, an event that answers a directive, a payload that does not fit and a message over 16000 bytes. TurnOn of a device with WakeOnLANController is deferred without the warning. On the wire: a doorbell has no properties object and proactivelyReported on the capability; SimpleEventSource is version 1.0, InventoryLevelSensor and WakeOnLANController version 3 (1.5.2: 1). A scene declared without options is announced as before. Alex2MQTT has no topic yet for the WakeUp event. 24 examples of the six pages are saved as fixtures. 267 tests pass, 241 before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
34 lines
1.7 KiB
JavaScript
34 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.DoorbellEventSource = void 0;
|
|
const events_js_1 = require("../events.js");
|
|
const types_js_1 = require("../types.js");
|
|
/**
|
|
* A doorbell. It takes no directive and reports nothing; device.raise(DoorbellEventSource, "DoorbellPress") says
|
|
* that somebody rang. Alexa wants 30 seconds between two presses of one doorbell, and announces a press when the
|
|
* user switched the announcements on for the doorbell in the Alexa app.
|
|
*/
|
|
exports.DoorbellEventSource = (0, types_js_1.defineInterface)({
|
|
namespace: "Alexa.DoorbellEventSource",
|
|
version: "3",
|
|
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-doorbelleventsource.html",
|
|
kind: "eventSource",
|
|
tier: 2,
|
|
instanced: false,
|
|
properties: {},
|
|
directives: {},
|
|
events: {
|
|
DoorbellPress: { name: "DoorbellPress", payload: (0, events_js_1.happened)("PHYSICAL_INTERACTION"), topic: "proactive" },
|
|
},
|
|
// The capability is the announcement that the endpoint raises the event: proactivelyReported whatever was declared
|
|
discovery: () => ({ properties: false, topLevel: { proactivelyReported: true } }),
|
|
// alexa-doorbelleventsource.html, "Discovery"
|
|
validate(capability, { displayCategories }) {
|
|
const doorbell = displayCategories.indexOf("DOORBELL");
|
|
if (doorbell < 0)
|
|
throw new types_js_1.DeclarationError(capability, "a doorbell has the display category DOORBELL");
|
|
if (displayCategories.indexOf("CAMERA") > doorbell) {
|
|
throw new types_js_1.DeclarationError(capability, "a video doorbell lists the display category CAMERA before DOORBELL");
|
|
}
|
|
},
|
|
});
|