@mega-yfue/eufy-sdk / EufyDevice
Interface: EufyDevice
Normalised device record, regardless of which API produced it.
Properties
api
api: ApiBackend;Which cloud API owns this device.
category
category: string;Anker category string: eufy_security | eufy_mega | eufy_home …
deviceClass
deviceClass: DeviceClass;lastSeenMs?
optional lastSeenMs?: number;The most recent paramUpdatedAt across all of this device's params, in milliseconds (comparable to Date.now() directly). undefined when the record carried no timestamp at all.
This is an observation — "the device last reported at T" — deliberately not a reachability verdict. How long a silence means "unreachable" depends on the device (a mains camera heartbeats constantly; a battery sensor may be quiet for days by design), so the threshold is the caller's to choose; the SDK reports the fact.
model
model: string;name?
optional name?: string;p2pDid?
optional p2pDid?: string;Present (and non-empty) for P2P devices.
params?
optional params?: Record<number, string>;Device state data points (param_type → param_value), exactly as the cloud record carries them. Raw and unnamed: the capability surface resolves these into named properties. Device.inspect labels them for troubleshooting.
Not a realtime source. These are refreshed server-side on the device's own cloud heartbeat, which is slow: measured across a live fleet, the freshest param on an active device was ~12 minutes old, and the per-device get_device_param_list call returns the same staleness as the bulk list (so fetching harder does not make them fresher). They are a coarse state snapshot plus liveness evidence (paramUpdatedAt); realtime state arrives over push / P2P / MQTT.
paramUpdatedAt?
optional paramUpdatedAt?: Record<number, number>;When each param in params was last written server-side (param_type → unix SECONDS, the wire's own update_time unit — not milliseconds). The device heartbeats its params up to the cloud, so these are the freshest liveness evidence available without opening a transport.
Sparse by construction: a param the record delivered without an update_time has no entry here.
raw?
optional raw?: unknown;Raw record from the source API, for fields not yet normalised.
realtime
realtime: RealtimeKind;Which realtime transport carries its live state/commands.
sn
sn: string;stationSn?
optional stationSn?: string;The station this device's traffic belongs to: its parent HomeBase, or its own serial when it has none.
parent_sn carries the parent on an attached device. station_sn is frequently absent there — empty on every attached sensor of a T8010 — and serves only as a fallback for a device naming no parent.