-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
62 lines (45 loc) · 1.38 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {EventEmitter} from 'events';
export = WebSocketClient;
declare class WebSocketClient extends EventEmitter.EventEmitter {
constructor(options: {
/**
* ip of device as string
*/
ip: string
/**
* either Pin on the back or device token (if paired with App! Needs to be extracted, see readme).
*/
pin: string;
/**
* defaults to 8080
*/
port?: number;
/**
* either w115 or w245.
*/
model?: string;
/**
* function for debug logging, defaults to noop.
*/
log?: (string) => void;
/**
* seconds to ping, defaults to 30. 0 to turn off.
*/
keepAlive?: number;
/**
* library should get the device token from telnet (which needs to be active).
*/
useTelnetForToken?: boolean;
});
connect(): Promise<boolean>;
disconnect(): void;
getDeviceId(): string;
getDeviceInfoFromTelnet(): Promise<Record<string, string>>;
getTokenFromTelnet(): Promise<boolean>;
login(): Promise<boolean>;
setPin(newPin: string): void;
isDeviceReady(): boolean;
switch(on: boolean, socket?: number): Promise<boolean>;
switchLED(on: boolean, led?: number): Promise<boolean>;
state(socket?: number): Promise<boolean | Array<boolean> >;
}