import { StateUpdateRecord } from './eventsource.js'; /** * Every identifier we accept for a given logical entity, most likely first. * * Firmware revisions and custom builds name things differently, and the published REST reference * doesn't always agree with the devices: it documents the pre-close warning button as * `pre_close_warning`, while devices report `pre-close_warning` (ESPHome's sanitizer keeps hyphens, * which is also what makes `Security+ protocol` come out as `security__protocol`). Rather than * betting on one spelling, state updates match any key in the group and commands fall back through * all of them. */ export declare const ENTITY_KEYS: Record; /** * Display names of the entities we send commands to, keyed by their legacy identifier. Only used * as a fallback when we haven't (yet) seen the entity on the SSE stream: on firmware that dropped * the object_id paths, guessing the stock name beats guessing nothing. */ export declare const KNOWN_ENTITY_DISPLAY_NAMES: Record; export type ParsedEntityID = { /** ESPHome domain, always underscored (`binary_sensor`, `cover`, ...) */ domain: string; /** Sanitized object_id (`garage_door`), derived from the display name when necessary */ objectID: string; /** Display name, known only when the device reported a new-format identifier */ displayName?: string; /** Legacy-style `${domain}-${objectID}` identifier, stable across firmware versions */ key: string; /** REST path for this entity in the format the reporting device accepts */ path: string; }; /** ESPHome's object_id sanitizer: lowercase, and anything outside [a-z0-9_-] becomes an underscore. */ export declare const sanitizeObjectID: (displayName: string) => string; /** Pre-2026.7 REST path, e.g. `/cover/garage_door` */ export declare const buildLegacyEntityPath: (domain: string, objectID: string) => string; /** 2026.1.3+ REST path, e.g. `/cover/Garage%20Door` */ export declare const buildNamedEntityPath: (domain: string, displayName: string) => string; /** Splits either identifier format into its domain and object_id, plus the REST path it implies. */ export declare const parseEntityID: (rawID?: string) => ParsedEntityID | undefined; /** Prefers `name_id` when the firmware provides it, since `id` is the legacy field until 2026.8. */ export declare const getEntityID: (record: StateUpdateRecord) => string; export declare const parseStateRecord: (record: StateUpdateRecord) => ParsedEntityID | undefined; /** True when a parsed identifier is any of the accepted spellings for an entity. */ export declare const isEntity: (entity: ParsedEntityID | undefined, entityKeys: string[]) => boolean; /** * REST paths worth trying for an entity, best-first: whatever the device advertised over SSE, then * the display-name paths (the only format ESPHome >= 2026.7 answers), then the object_id paths (the * only format ESPHome < 2026.1.3 answers). Each tier covers every accepted spelling of the entity * before the next tier starts guessing. */ export declare const buildEntityPathCandidates: (entityKeys: string[], discoveredPaths: Map) => string[];