Skip to content

eufy-mega / model/capabilities / EventMapping

Interface: EventMapping

A declarative inbound-event mapping — the dual of DetectionSpec for events. A capability lists which push eventTypes / poll paramTypes belong to it and the semantic event name each emits. The barrel folds all modules' mappings into one lookup index (built once), so dispatch is a direct id→event lookup — no per-module decode code for the common case.

Properties

emit

ts
emit: string;

The semantic SDK event name to emit (e.g. "motion", "doorbellPress", "lockState").


match

ts
match: number | [number, number];

An exact id, or an inclusive [lo, hi] range (e.g. lock push events 257..771).


payload?

ts
optional payload?: Record<string, unknown>;

Static fields folded into the emitted event payload — lets several ids emit the same event name with a discriminator (e.g. battery pushes 6/7/11 all → batteryAlert with {state:"low"|"hot"|"full"}). Merged OVER the signal's own fields, so a raw wire key can't overwrite a discriminator.


source

ts
source: "push" | "poll";

Which source this id comes from. (p2p-frame decoding uses CapabilityModule.decodeEvent.)

Methods

derive()?

ts
optional derive(signal): Record<string, unknown>;

Fields DERIVED from the signal — for state a push carries under an opaque single-letter wire key that no host should be expected to decode itself. Merged last, over both the raw body and payload.

Same evidence bar as everything else: only map a key whose meaning is confirmed in the V6 app or a capture. Return {} when this signal doesn't carry the field, so nothing is invented.

Parameters

signal

InboundSignal

Returns

Record<string, unknown>

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations or eufy. "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.