Skip to content

@mega-yfue/eufy-sdk / freshestLanIp

Function: freshestLanIp()

ts
function freshestLanIp(raw): string | undefined;

Resolve the freshest LAN IP for a station from its cloud record.

The record carries the device IP in several places of differing trust:

  • params ({param_type, param_value, update_time}) — self-reported by the device on each heartbeat, so a private-IP param value is timestamped and updates when the device roams.
  • ip_addr (top-level) — frozen at pairing, no timestamp; goes stale if the device moved to another subnet since (observed live: a SoloCam still advertising a 192.168.86.x pairing address while actually on 192.168.1.x).
  • local_ip — often empty, or the public WAN address.

Strategy: collect every param whose value is a private IPv4, take the one with the newest update_time, and only fall back to ip_addr / local_ip when no param IP exists. This prefers the most recent evidence over a fixed field-priority order.

Parameters

raw

unknown

Returns

string | undefined

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