@evops/lightwaverf 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import dgram from 'dgram';
3
+ import Debug from 'debug';
4
+ import { LightwaveRFClient } from './LightwaveRFClient';
5
+ import { LightwaveDevice } from './LightwaveDevice';
4
6
  declare class LightwaveRFConfiguration {
5
7
  timeout?: number;
6
8
  ip?: string;
@@ -9,36 +11,29 @@ declare class LightwaveRFConfiguration {
9
11
  email?: any;
10
12
  pin?: any;
11
13
  }
12
- interface LightwaveRFDevice {
13
- roomId: number;
14
- deviceId: number;
15
- roomName: string;
16
- deviceName: string;
17
- deviceType: string;
18
- }
19
- declare interface LightwaveRF {
14
+ declare interface ILightwaveRF {
20
15
  on(event: 'deviceTurnedOn', listener: (roomId: number, deviceId: number) => void): this;
21
16
  on(event: 'deviceTurnedOff', listener: (roomId: number, deviceId: number) => void): this;
17
+ on(event: 'deviceDimmed', listener: (roomId: number, deviceId: number, percentage: number) => void): this;
22
18
  }
23
- /**
24
- * LightwaveRF API
19
+ /** * LightwaveRF API
25
20
  *
26
21
  * @param object config The config
27
22
  *
28
23
  * An instance of the LightwaveRF API
29
24
  */
30
- declare class LightwaveRF extends EventEmitter {
25
+ export default class LightwaveRF extends EventEmitter implements ILightwaveRF {
31
26
  timeout: number;
32
27
  queue: any;
33
28
  ready: boolean;
34
29
  awaitRegistrration: boolean;
35
30
  currentTransactionNumber: number;
36
- devices: Array<LightwaveRFDevice>;
31
+ devices: Array<LightwaveDevice>;
37
32
  messageCounter: number;
38
33
  config: LightwaveRFConfiguration;
39
- sendSocket: dgram.Socket;
40
- receiveSocket: dgram.Socket;
41
34
  responseListeners: Map<number, any>;
35
+ lwClient: LightwaveRFClient;
36
+ debug: Debug.Debugger;
42
37
  constructor(config: LightwaveRFConfiguration, callback: (config: any, error: any) => void);
43
38
  stop(): void;
44
39
  initialiseConfiguration(callback: (config: any, error: string) => void): void;
@@ -50,14 +45,6 @@ declare class LightwaveRF extends EventEmitter {
50
45
  * @return void
51
46
  */
52
47
  register(callback: any): void;
53
- /**
54
- * Request energy
55
- *
56
- * @param Function callback The callback function
57
- *
58
- * @return void
59
- */
60
- requestEnergy(callback: any): void;
61
48
  /**
62
49
  * Turn a device off
63
50
  *
@@ -67,7 +54,7 @@ declare class LightwaveRF extends EventEmitter {
67
54
  *
68
55
  * @return void
69
56
  */
70
- turnDeviceOff(roomId: string, deviceId: string, callback?: any): void;
57
+ turnDeviceOff(roomId: number, deviceId: number, callback?: any): void;
71
58
  /**
72
59
  * Turn a device on
73
60
  *
@@ -77,46 +64,7 @@ declare class LightwaveRF extends EventEmitter {
77
64
  *
78
65
  * @return void
79
66
  */
80
- turnDeviceOn(roomId: string, deviceId: string, callback?: any): void;
81
- /**
82
- * Open a device
83
- *
84
- * @param integer roomId The room ID
85
- * @param integer deviceId The device ID
86
- * @param Function callback The callback for if there are any errors
87
- *
88
- * @return void
89
- */
90
- openDevice(roomId: string, deviceId: string, callback: any): void;
91
- /**
92
- * Close a device
93
- *
94
- * @param integer roomId The room ID
95
- * @param integer deviceId The device ID
96
- * @param Function callback The callback for if there are any errors
97
- *
98
- * @return void
99
- */
100
- closeDevice(roomId: string, deviceId: string, callback: any): void;
101
- /**
102
- * Stop a device
103
- *
104
- * @param integer roomId The room ID
105
- * @param integer deviceId The device ID
106
- * @param Function callback The callback for if there are any errors
107
- *
108
- * @return void
109
- */
110
- stopDevice(roomId: string, deviceId: string, callback: any): void;
111
- /**
112
- * Turn all devices in a room off
113
- *
114
- * @param integer roomId The room ID
115
- * @param Function callback The callback for if there are any errors
116
- *
117
- * @return void
118
- */
119
- turnRoomOff(roomId: string, callback: any): void;
67
+ turnDeviceOn(roomId: number, deviceId: number, callback?: any): void;
120
68
  /**
121
69
  * Set the dim percentage of a device
122
70
  *
@@ -146,14 +94,5 @@ declare class LightwaveRF extends EventEmitter {
146
94
  */
147
95
  private sendUdp;
148
96
  private process;
149
- /**
150
- * Parser to get de devices from https POST
151
- */
152
- getDevices(roomsString: string, devicesString: string, typesString: string, callback: (object: any, lw: this) => void): void;
153
- parseRooms(lightwaveResponse: any, callback: any): void;
154
- /**
155
- * Connect to the server and obtain the configuration
156
- */
157
- getConfiguration(email: string, pin: string, manager_host: string, callback: any): void;
158
97
  }
159
- export default LightwaveRF;
98
+ export {};