eufy-mega / client/eufy-mega / DeviceState
Interface: DeviceState
What the SDK can honestly say about a device's liveness at one instant — the facts, never a verdict.
There is deliberately no online: boolean. "Unreachable" is a threshold decision, and the right threshold differs per device: a mains camera reports constantly, while a battery contact sensor can be silent for days by design and is perfectly healthy. Baking one timeout into the SDK would force that choice on every host. The SDK reports when the device last spoke; the caller decides what that means — the same split as the snapshot cache TTL and the live power budget.
P2P session state is not a liveness signal and is not carried here: sessions are opened only when something needs one and closed when idle, so "no session" is the resting state of a healthy device. Transport visibility lives on getP2pSessions() and the p2pConnect/p2pClose events, station-scoped like the session itself.
The cloud record carries no connectivity field either: it has no status / device_online, and the connection-related fields it does carry are opaque routing strings, not booleans.
Properties
lastSeenMs?
optional lastSeenMs?: number;When the device last reported to the cloud, in ms. Bounded by the cloud's own slow refresh — minutes, not seconds — so it answers "is this device alive at all", not "what is it doing right now".
sn
sn: string;stationSn
stationSn: string;The parent station whose P2P session covers this device (itself, when standalone).