/** * Device detection utilities, ported from the ioBroker n8n nodes * (`IoBrokerNodes/DevicesUtils.ts`). * * Uses the ioBroker type detector (https://github.com/ioBroker/ioBroker.type-detector) * to turn raw states/channels/devices into "controls" (functional devices) and groups * them into an AI-friendly structure of rooms -> devices -> named controls. * * All object reads accept an optional `{ user }` so the detection respects the ACLs of * the configured default user (see McpServer). */ import { type ExternalDetectorState, Types } from '@iobroker/type-detector'; /** Read options passed through to `getObjectViewAsync` (currently only the ACL user). */ export interface ReadOptions { user?: `system.user.${string}`; } export type SmartNameObject = { [lang in ioBroker.Languages]?: string; } & { smartType?: string | null; byON?: string | null; toggle?: boolean; }; export type SmartName = null | false | string | SmartNameObject; /** Detector state enriched with the concrete object id, smart name and common metadata. */ export interface IotExternalDetectorState extends ExternalDetectorState { id: string; smartName: SmartName | undefined; common: { min?: number; max?: number; unit?: string; type?: ioBroker.CommonType; states?: { [value: string]: string; }; role?: string; name?: ioBroker.StringOrTranslated; icon?: string; color?: string; }; } export interface IotExternalPatternControl { states: IotExternalDetectorState[]; type: Types; enumRequired?: boolean; object?: { id: string; type: ioBroker.ObjectType; common: ioBroker.StateCommon | ioBroker.ChannelCommon | ioBroker.DeviceCommon; autoDetected: boolean; toggle?: boolean; smartName?: SmartName; }; groupNames: string[]; room?: { id: string; common: ioBroker.EnumCommon; }; functionality?: { id: string; common: ioBroker.EnumCommon; }; } /** * Checks whether the provided value is a valid smart name. * * @param smartName The value to check * @param lang Configured language * @returns True if a valid smart name, false - otherwise. */ export declare function isValidSmartName(smartName: SmartName | undefined, lang: ioBroker.Languages): boolean; /** * Inspects all objects (states, channels and devices) and tries to identify so-called 'controls' * * To identify the controls, the ioBroker type detector library is used (https://github.com/ioBroker/ioBroker.type-detector). * * @param adapter The adapter instance * @param lang language * @param options read options (ACL user) * @returns An array containing the detected controls */ export declare function controls(adapter: ioBroker.Adapter, lang: ioBroker.Languages, options?: ReadOptions): Promise; type RoomName = string; type FunctionalityName = string; type ControlType = 'power' | 'dimmer' | 'blindPosition' | 'stop' | 'openedClosed' | 'alarm' | 'color' | 'colorRed' | 'colorGreen' | 'colorBlue' | 'colorWhite' | 'colorTemperature' | 'openClose' | 'open' | 'close' | 'fanSpeed' | 'fillLevel' | 'boostMode' | 'swingPosition' | 'saturation' | 'swingOnOff' | 'actualTemperature' | 'humidity' | 'illuminance' | 'level' | 'volume' | 'targetTemperature' | 'lock' | 'valve'; type ControlInDevice = { stateId: string; controlType: ControlType; ioBrokerValueType: ioBroker.CommonType; writable: boolean; readable: boolean; min?: number; max?: number; unit?: string; states?: { [value: string]: string; }; role?: string; }; export interface Device { deviceName: string | ioBroker.StringOrTranslated | undefined; deviceType: Types; friendlyDeviceNames: string[]; room?: RoomName; functionality?: FunctionalityName; controls: { [controlType: string]: ControlInDevice; }; } export interface Room { roomName: RoomName; devicesInRoom: Device[]; } export interface Functionality { functionalityName: FunctionalityName; devicesInFunctionality: Device[]; } /** * Build an AI-friendly structure of rooms -> devices -> named controls. * * @param adapter The adapter instance * @param lang language * @param options read options (ACL user) */ export declare function getAiFriendlyStructure(adapter: ioBroker.Adapter, lang: ioBroker.Languages, options?: ReadOptions): Promise; export {};