eufy-mega / core/contracts / Command
Type Alias: Command
type Command =
| {
channel: number;
form: ScalarForm;
kind: "set-param";
param: number;
value: number;
}
| {
channel: number;
data: Record<string, unknown>;
kind: "set-json";
param: number;
}
| {
channel: number;
cmd: number;
data: Record<string, unknown>;
kind: "set-json-raw";
}
| {
channel: number;
cmd: number;
kind: "set-payload";
mValue3?: number;
payload: Record<string, unknown>;
}
| {
channel: number;
enabled: boolean;
kind: "p2p-privacy-burst";
}
| {
channel: number;
cmd: number;
kind: "p2p-station-scalar";
value: number;
}
| object & Ff09Identity
| {
adminUserId: string;
delaySeconds?: number;
deviceSn: string;
enabled: boolean;
kind: "ff09-autolock";
}
| {
adminUserId: string;
deviceSn: string;
kind: "ff09-setting-toggle";
settingId: number;
value: boolean;
}
| {
cmdCode: number;
fields: ReadonlyArray<{
tag: number;
value: Buffer;
}>;
kind: "mqtt-dp";
mqttCmdCode: number;
}
| {
cmdCode: number;
companionCmdCode: number;
kind: "mqtt-dp-preset";
mqttCmdCode: number;
presetId: number;
}
| {
dp: number;
kind: "tuya-dp";
value: boolean | number | string;
};A transport-neutral outbound command intent. Capability modules emit one of these; they never call the network directly, never name a transport, and never carry a routing key. The CommandSink routes each by kind; kinds are named after the WIRE MECHANISM (the frame or protocol), never the capability that happens to be the first caller. Most carry an opaque param/id + value; a kind whose wire interaction is a bespoke sequence (a burst, a read-modify-write) earns its own variant. The ff09-* kinds share ONE frame that rides BOTH P2P and secure-MQTT, so the sink routes them by the device's runtime topology and the chosen router re-resolves its own routing tail from the device record — nothing transport- or route-specific lives in the intent.