homebridge-wled-ws
Version:
WLED strips plugin for Homebridge
168 lines (167 loc) • 7 kB
TypeScript
import { PlatformAccessory, CharacteristicValue, CharacteristicGetCallback, CharacteristicSetCallback } from 'homebridge';
import { WledWsHomebridgePlatform } from './WledWsHomebridgePlatform';
import { WledControllerPreset } from './WledController';
import { Logger } from 'homebridge';
/**
* Platform Accessory
* An instance of this class is created for each accessory your platform registers
* Each accessory may expose multiple services of different service types.
*/
export declare class WledWsPlatformAccessory {
private readonly platform;
private readonly log;
private readonly accessory;
private readonly loggingEnabled;
private service;
private realTimeService?;
private presetList;
private activePreset;
private activePlaylist;
private wledClient;
private connectionClosed;
private connectionEstablished;
private reconnectIntervalId;
private reconnectIntervalMillis;
private init;
/**
* Tracks the LED state
*/
private ledState;
constructor(platform: WledWsHomebridgePlatform, log: Logger, accessory: PlatformAccessory, loggingEnabled: boolean);
/**
* Handle "SET" requests from HomeKit
* These are sent when the user changes the state of an accessory, for example, turning on a Light bulb.
*/
setOn(value: CharacteristicValue): Promise<void>;
/**
* Handle the "GET" requests from HomeKit
* These are sent when HomeKit wants to know the current state of the accessory, for example, checking if a Light bulb is on.
*
* GET requests should return as fast as possbile. A long delay here will result in
* HomeKit being unresponsive and a bad user experience in general.
*
* If your device takes time to respond you should update the status of your device
* asynchronously instead using the `updateCharacteristic` method instead.
* @example
* this.service.updateCharacteristic(this.platform.Characteristic.On, true)
*/
getOn(): Promise<CharacteristicValue>;
/**
* Set if the real time mode is active. This is a separate switch in Homekit to enable/disable
*/
liveSetOn(value: CharacteristicValue): Promise<void>;
/**
* Returns the real time mode state to Homekit
*/
liveGetOn(): Promise<CharacteristicValue>;
/**
* Handle "SET" requests from HomeKit
* These are sent when the user changes the state of an accessory, for example, changing the Brightness
*/
setBrightness(value: CharacteristicValue): Promise<void>;
/**
* Returns current brightness to Homekit
*/
getBrightness(): Promise<CharacteristicValue>;
/**
* Handle "SET" requests from HomeKit
* These are sent when the user changes the state of an accessory, for example, changing the Hue
*/
setHue(value: CharacteristicValue): Promise<void>;
/**
* Returns the Hue value to Homekit
*/
getHue(): Promise<CharacteristicValue>;
/**
* Handle "SET" requests from HomeKit
* These are sent when the user changes the state of an accessory, for example, changing the Saturation
*/
setSaturation(value: CharacteristicValue): Promise<void>;
/**
* Returns the saturation value to Homekit
*/
getSaturation(): Promise<CharacteristicValue>;
/**
* Sets the preset state from Homekit
*/
setPreset(preset: WledControllerPreset, value: CharacteristicValue, callback: CharacteristicSetCallback): Promise<void>;
/**
* Returns the preset state to Homekit
*/
getPreset(preset: WledControllerPreset, callback: CharacteristicGetCallback): void;
/**
* Connect the controller and bind the callback handlers for
* state, info, effects, palettes, presets, deviceOptions, lightCapabilities, config
*/
connect(isReconnect: boolean): Promise<boolean>;
/**
* Disconnects the controller. This happens on shutdown of the plugin only
*/
disconnect(): void;
/**
* Callback: each time controller's state changes this function is called. State changes can
* triggered by user interaction or other clients
*/
onStateReceived(): void;
/**
* Callback: each time controller's presets changes this function is called. Preset changes can
* triggered by user interaction or other clients. This function checks, if the configured presets
* are available on the controller. If not, a error message is logged to the console
*/
onPresetsReceived(): void;
/**
* Callback: each time controller's effects changes this function is called. Effect changes can
* triggered by user interaction or other clients
*/
onEffectsReceived(): void;
/**
* Callback: each time controller's config changes this function is called. Config changes can
* triggered by user interaction or other clients
*/
onConfigReceived(): void;
/**
* Callback: each time controller's info changes this function is called. State info can
* triggered by user interaction or other clients
*/
onInfoReceived(): void;
/**
* Refresh presets to update preset information. This is done, when the controller is turned off
* to avoid too much cpu load on the controller when the lights or effetcs are on. Presets can be
* configured by the user or an API anytime - so we need to update this information regularly.
*/
refreshPresets(): void;
/**
* Refresh effects to update effect information.
*/
refreshEffects(): void;
/**
* Callback: connection to the controller is established
*/
onConnected(): void;
/**
* Callback: connection to the controller is closed
*/
onDisconnected(): void;
/**
* Callback: connection to the controller throws an error (e.g. is closed by controller)
*/
onError(error: any): void;
/**
* After successful connect to the controller, its properties are read and set as
* accessory information. WLED support different LED stripe types. The configuration is
* sent via the JSON object "info" and its element "lightCapabilities". The plugin adds
* its services and characteristics according to the retrieved data. If a specific service
* is not needed it can be disabled using the settings dialog.
*
* See https://kno.wled.ge/interfaces/json-api/#light-capabilities
*
* The following behaviour is implemented:
* Single Color LED stripe or OnOff only: LightBulb with characteristic On and Brightness
* RGB Color LED stripe: LightBulb with characteristic On, Brightness, Hue, Saturation
* RGB Color LED stripe with White LED:
* - LightBulb with characteristic On, Brightness, Hue, Saturation for RGB
* - LightBulb with characteristic On, Brightness for White (can be disabled in settings)
*/
updateAccessoryInformation(): void;
}
//# sourceMappingURL=WledWsPlatformAccessory.d.ts.map