homebridge-z2m
Version:
Expose your Zigbee devices to HomeKit with ease, by integrating Zigbee2MQTT with Homebridge.
28 lines • 2.22 kB
TypeScript
import { Characteristic, CharacteristicValue, Service, WithUUID } from 'homebridge';
import { ExposesEntry } from './z2mModels';
export declare function errorToString(e: unknown): string;
/**
* Parse bridge/state payload from Zigbee2MQTT and return online status.
* Supports both z2m 2.0+ JSON format ({"state":"online"}) and legacy plain string format ("online").
* @param payload The raw payload string from MQTT
* @returns true if Zigbee2MQTT is online, false otherwise
*/
export declare function parseBridgeOnlineState(payload: string): boolean;
/**
* Added because of the following warning from HAP-NodeJS:
* "The accessory '<SOME NAME HERE>' has an invalid 'Name' characteristic ('<SOME NAME HERE>'). Please use only alphanumeric, space, and
* apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the
* accessory from being added in the Home App or cause unresponsiveness."
* @param name
*/
export declare function sanitizeAccessoryName(name: string): string;
export declare function getDiffFromArrays<T>(a: T[], b: T[]): T[];
export declare function getOrAddCharacteristic(service: Service, characteristic: WithUUID<new () => Characteristic>): Characteristic;
export declare function roundToDecimalPlaces(input: number, decimalPlaces: number): number;
export declare function copyExposesRangeToCharacteristic(exposes: ExposesEntry, characteristic: Characteristic): boolean;
export declare function allowSingleValueForCharacteristic(characteristic: Characteristic, value: CharacteristicValue): Characteristic;
export declare function setValidValuesOnCharacteristic(characteristic: Characteristic, validValues: number[]): Characteristic;
export declare function groupByEndpoint<Entry extends ExposesEntry>(entries: Entry[]): Map<string | undefined, Entry[]>;
export declare function getAllEndpoints(entries: ExposesEntry[], parentEndpoint?: string): (string | undefined)[];
export declare function sanitizeAndFilterExposesEntries(input: ExposesEntry[], filter?: (entry: ExposesEntry) => boolean, valueFilter?: (entry: ExposesEntry) => string[], parentEndpoint?: string | undefined): ExposesEntry[];
//# sourceMappingURL=helpers.d.ts.map