registry: SceneController events, DoorbellEventSource, SimpleEventSource, TimeHoldController, InventoryLevelSensor, WakeOnLANController

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>
This commit is contained in:
David 2026-09-28 21:01:53 +00:00
parent d7dfc5b122
commit 3a07c861b1
116 changed files with 3136 additions and 166 deletions

View file

@ -8,7 +8,7 @@ import type { ChangeCause } from "../messages/types.js";
import type { DirectiveHandler, Fill } from "../dispatcher.js";
import type { DisplayCategoryName } from "../registry/catalog.js";
import type { Directives, InterfaceDescriptor, Properties } from "../registry/types.js";
import type { Publisher } from "../transport.js";
import type { Publisher, PublishResult } from "../transport.js";
import { Capability } from "./Capability.js";
import type { AnyCapability, CapabilityJson, Declaration } from "./Capability.js";
import type { EndpointFields } from "./validate.js";
@ -102,6 +102,23 @@ declare class Device extends EventEmitter {
* (1.5.1). Resolves with the topic published to, or "" when the publish failed (never rejects, 1.5.2).
*/
sendSceneResponse(correlationToken: string, activated: boolean, cause?: ChangeCause, sendAsync?: boolean): Promise<string>;
/**
* Say that something happened on the device, which nobody asked for:
*
* door.raise(DoorbellEventSource, "DoorbellPress");
* remote.raise(SimpleEventSource, "Event", { id: "Button.SinglePush.1" }, { instance: topButton.instance });
*
* The event goes to <root>/event, which Alex2MQTT posts to Alexa: up to 30 events a minute for a root. The
* payload is checked by the descriptor, which also sets the time of the event to now and its cause to the usual
* one when the payload has none. Resolves with what became of the publish and does not reject.
*
* Throws a MessageError for an event that would not arrive: of an interface or an instance the device did not
* declare, not an event of the interface, with a payload that does not fit, or too long for Alex2MQTT.
*/
raise(descriptor: InterfaceDescriptor<any, any, any, boolean>, name: string, payload?: Record<string, unknown>, options?: {
instance?: string;
messageId?: string;
}): Promise<PublishResult>;
/**
* How the device reports its state, every retrievable property of it:
*