Interface API

interface API {
    hap: __module;
    hapLegacyTypes: __module;
    platformAccessory: typeof PlatformAccessory;
    serverVersion: string;
    user: typeof User;
    version: number;
    on(event, listener): this;
    on(event, listener): this;
    publishCameraAccessories(pluginIdentifier, accessories): void;
    publishExternalAccessories(pluginIdentifier, accessories): void;
    registerAccessory(accessoryName, constructor): void;
    registerAccessory(pluginIdentifier, accessoryName, constructor): void;
    registerPlatform(platformName, constructor): void;
    registerPlatform(pluginIdentifier, platformName, constructor): void;
    registerPlatformAccessories(pluginIdentifier, platformName, accessories): void;
    unregisterPlatformAccessories(pluginIdentifier, platformName, accessories): void;
    updatePlatformAccessories(accessories): void;
    versionGreaterOrEqual(version): boolean;
}

Properties

hap: __module
hapLegacyTypes: __module
platformAccessory: typeof PlatformAccessory
serverVersion: string

The current homebridge semver version.

user: typeof User
version: number

The homebridge API version as a floating point number.

Methods

  • Parameters

    • event: "didFinishLaunching"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "shutdown"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Returns true if the current running homebridge version is greater or equal to the passed version string.

    Example:

    We assume the homebridge version 1.3.0-beta.12 (serverVersion) and the following example calls below

     versionGreaterOrEqual("1.2.0"); // will return true
    versionGreaterOrEqual("1.3.0"); // will return false (the RELEASE version 1.3.0 is bigger than the BETA version 1.3.0-beta.12)
    versionGreaterOrEqual("1.3.0-beta.8); // will return true

    Parameters

    • version: string

    Returns boolean