Skip to content

@mega-yfue/eufy-sdk / buildModelIndex

Function: buildModelIndex() ​

ts
function buildModelIndex(categories): Map<string, {
  category: string;
  name: string;
}>;

Flatten a product catalog into a product_code → { name, category } lookup for labelling discovered devices. Every variant code in p_codes maps to its parent product too, so a device reporting a sub-model resolves to the same marketing name.

The category name is trimmed here, at ingest — the live catalog returns some names with trailing whitespace (e.g. "Plug-in Home Battery "), and normalising once at the source means every consumer (a device's identity().category, detectSolixCapabilities, and any exact-match category test) sees the clean name, rather than each call site having to remember to trim.

Parameters ​

categories ​

SolixProductCategory[]

Returns ​

Map<string, { category: string; name: string; }>

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.