homebridge-framework
Version:
Framework for easy creation of homebridge plugins.
56 lines (55 loc) • 1.94 kB
TypeScript
import { Characteristic as HapCharacteristic, CharacteristicValue, CharacteristicProps } from 'hap-nodejs';
import { Service } from './service';
/**
* Represents a wrapper around HAP characteristics with with support for easy configuration and update.
*/
export declare class Characteristic<TValue extends CharacteristicValue> {
/**
* Initializes a new Characteristic instance.
* @param service The parent service.
* @param type The type of the characteristic.
* @param value The initial value. If omitted, the cached value is used.
*/
constructor(service: Service, type: typeof HapCharacteristic, value?: TValue);
/**
* Contains the parent service.
*/
private service;
/**
* Contains the characteristic.
*/
private _hapCharacteristic;
/**
* Contains the type of the characteristic.
*/
private _type;
/**
* Gets the type of the characteristic.
*/
get type(): typeof HapCharacteristic;
/**
* Updates the properties of the characteristic.
* @param properties The new properties of the characteristic.
*/
setProperties(properties: CharacteristicProps): void;
/**
* Gets the value of the characteristic.
*/
get value(): TValue | null;
/**
* Sets the value of the characteristic.
*/
set value(value: TValue | null);
/**
* Contains a handler that is executed when the value of the characteristic has been changed by the user.
*/
private _valueChanged;
/**
* Gets a handler that is executed when the value of the characteristic has been changed by the user.
*/
get valueChanged(): ((newValue: TValue) => Promise<void> | void) | null;
/**
* Sets a handler that is executed when the value of the characteristic has been changed by the user.
*/
set valueChanged(value: ((newValue: TValue) => Promise<void> | void) | null);
}