UNPKG

@homenet/plugin-zway

Version:

Homenet plugin for Z-Way connected Z-Wave devices

54 lines (53 loc) 1.52 kB
/// <reference path="../src/node-zway.d.ts" /> import { IDevice } from 'node-zway'; export interface DeviceEvent { deviceId: string; } export interface LockEvent { device: string; class: string; className: string; event: string; data: number; } export interface AlarmEvent { device: string; class: string; className: string; event: string; data: { alarmType: number; level: number; }; } export interface SensorEvent { device: string; class: string; className: string; event: string; data: { sensorTypeString: string; level: number | boolean | string; val: number; scale: number; scaleString: string; deviceScale: string; }; } export interface DeviceEventCallback extends EventCallback<DeviceEvent> { } export interface EventCallback<T> { (event: T): void; } export declare class ZwayController { private _deviceApi; constructor(id: string, host?: string, user?: string, password?: string, port?: number); start(): void; onSensorBinaryEvent(deviceId: number, callback: DeviceEventCallback): void; onSensorMultiEvent(deviceId: number, callback: DeviceEventCallback): void; onLockEvent(deviceId: number, callback: EventCallback<LockEvent>): void; onAlarmEvent(deviceId: number, callback: EventCallback<AlarmEvent>): void; getDevice(deviceId: number): IDevice; getLockDevice(deviceId: number): IDevice; getSensorDevice(deviceId: number): IDevice; }