export interface Z2mAdapterCallbacks { onBridgeOnline?: () => void | Promise; onBridgeOffline?: () => void | Promise; onDevicesReceived?: (devices: Z2mDevice[]) => void | Promise; onDeviceStateChanged?: (friendlyName: string, state: Record) => void | Promise; onDeviceAvailabilityChanged?: (friendlyName: string, available: boolean) => void | Promise; onDeviceJoined?: (ieeeAddress: string, friendlyName: string) => void | Promise; onDeviceLeft?: (ieeeAddress: string, friendlyName: string) => void | Promise; } export interface Z2mBridgeState { state: 'online' | 'offline'; } export interface Z2mBridgeEvent { type: 'device_joined' | 'device_announce' | 'device_interview' | 'device_leave'; data: { friendly_name?: string; ieee_address?: string; status?: string; }; } export interface Z2mDeviceAvailability { state: 'online' | 'offline'; } export interface Z2mDevice { ieee_address: string; type: 'Coordinator' | 'Router' | 'EndDevice'; friendly_name: string; description?: string; network_address: number; supported: boolean; disabled: boolean; definition?: Z2mDeviceDefinition; power_source?: string; software_build_id?: string; model_id?: string; date_code?: string; interviewing?: boolean; interview_completed?: boolean; } export interface Z2mDeviceDefinition { model: string; vendor: string; description: string; exposes: Z2mExpose[]; options?: Z2mOption[]; } export interface Z2mExposeBase { type: string; name?: string; label?: string; property?: string; access?: number; description?: string; category?: 'config' | 'diagnostic'; endpoint?: string; } export interface Z2mExposeBinary extends Z2mExposeBase { type: 'binary'; value_on: string | boolean; value_off: string | boolean; value_toggle?: string; } export interface Z2mExposeNumeric extends Z2mExposeBase { type: 'numeric'; value_min?: number; value_max?: number; value_step?: number; unit?: string; presets?: Z2mPreset[]; } export interface Z2mExposeEnum extends Z2mExposeBase { type: 'enum'; values: string[]; } export interface Z2mExposeText extends Z2mExposeBase { type: 'text'; } export interface Z2mExposeComposite extends Z2mExposeBase { type: 'composite'; features: Z2mExpose[]; } export interface Z2mExposeList extends Z2mExposeBase { type: 'list'; item_type: string; length_min?: number; length_max?: number; } export interface Z2mExposeSpecific extends Z2mExposeBase { type: 'light' | 'switch' | 'fan' | 'cover' | 'lock' | 'climate'; features: Z2mExpose[]; } export type Z2mExpose = Z2mExposeBinary | Z2mExposeNumeric | Z2mExposeEnum | Z2mExposeText | Z2mExposeComposite | Z2mExposeList | Z2mExposeSpecific; export interface Z2mPreset { name: string; value: number; description?: string; } export interface Z2mOption { name: string; type: string; description?: string; } export interface Z2mRegisteredDevice { ieeeAddress: string; friendlyName: string; description?: string; type: 'Router' | 'EndDevice'; supported: boolean; disabled: boolean; definition?: Z2mDeviceDefinition; powerSource?: string; modelId?: string; available: boolean; lastSeen?: Date; currentState: Record; } export interface Z2mSetPayload { [key: string]: unknown; } export interface Z2mParsedProperty { identifier: string; value: string | number | boolean; channelIdentifier: string; } export interface Z2mColorHS { hue: number; saturation: number; } export interface Z2mColorXY { x: number; y: number; } export interface Z2mColorRGB { r: number; g: number; b: number; } export type Z2mColor = Z2mColorHS | Z2mColorXY | Z2mColorRGB; export interface Z2mMqttConfig { host: string; port: number; username?: string; password?: string; baseTopic: string; clientId?: string; cleanSession: boolean; keepalive: number; connectTimeout: number; reconnectInterval: number; tls?: { enabled: boolean; rejectUnauthorized: boolean; ca?: string; cert?: string; key?: string; }; }