homebridge-plejd 1.3.3 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +14 -17
  3. package/dist/index.d.ts +2 -3
  4. package/dist/index.js +7 -5
  5. package/dist/index.js.map +1 -1
  6. package/dist/model/device.d.ts +0 -1
  7. package/dist/model/device.js +1 -2
  8. package/dist/model/plejdSite.d.ts +0 -1
  9. package/dist/model/plejdSite.js +44 -47
  10. package/dist/model/plejdSite.js.map +1 -1
  11. package/dist/model/userInputConfig.d.ts +0 -1
  12. package/dist/model/userInputConfig.js +1 -2
  13. package/dist/plejdApi.d.ts +3 -4
  14. package/dist/plejdApi.js +124 -123
  15. package/dist/plejdApi.js.map +1 -1
  16. package/dist/plejdPlatform.d.ts +8 -9
  17. package/dist/plejdPlatform.js +190 -188
  18. package/dist/plejdPlatform.js.map +1 -1
  19. package/dist/plejdPlatformAccessory.d.ts +0 -1
  20. package/dist/plejdPlatformAccessory.js +46 -48
  21. package/dist/plejdPlatformAccessory.js.map +1 -1
  22. package/dist/plejdService.d.ts +2 -3
  23. package/dist/plejdService.js +263 -257
  24. package/dist/plejdService.js.map +1 -1
  25. package/dist/plejdUtils.d.ts +1 -2
  26. package/dist/plejdUtils.js +11 -17
  27. package/dist/plejdUtils.js.map +1 -1
  28. package/dist/settings.d.ts +0 -1
  29. package/dist/settings.js +6 -9
  30. package/dist/settings.js.map +1 -1
  31. package/package.json +19 -22
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/model/device.d.ts.map +0 -1
  34. package/dist/model/plejdSite.d.ts.map +0 -1
  35. package/dist/model/userInputConfig.d.ts.map +0 -1
  36. package/dist/plejdApi.d.ts.map +0 -1
  37. package/dist/plejdPlatform.d.ts.map +0 -1
  38. package/dist/plejdPlatformAccessory.d.ts.map +0 -1
  39. package/dist/plejdService.d.ts.map +0 -1
  40. package/dist/plejdUtils.d.ts.map +0 -1
  41. package/dist/settings.d.ts.map +0 -1
  42. package/my-site.json +0 -2427
@@ -1,20 +1,20 @@
1
- import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
2
- import { PlejdPlatformAccessoryHandler } from './plejdPlatformAccessory';
3
- import { UserInputConfig } from './model/userInputConfig';
4
- import { Device } from './model/device';
5
- import { PlejdService } from './plejdService';
6
- import { Site } from './model/plejdSite';
1
+ import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from "homebridge";
2
+ import { PlejdPlatformAccessoryHandler } from "./plejdPlatformAccessory";
3
+ import { UserInputConfig } from "./model/userInputConfig";
4
+ import { Device } from "./model/device";
5
+ import { PlejdService } from "./plejdService";
6
+ import { Site } from "./model/plejdSite";
7
7
  export declare class PlejdPlatform implements DynamicPlatformPlugin {
8
8
  readonly log: Logger;
9
9
  readonly config: PlatformConfig;
10
- readonly api: API;
10
+ readonly homebridgeApi: API;
11
11
  readonly Service: typeof Service;
12
12
  readonly Characteristic: typeof Characteristic;
13
13
  userInputConfig?: UserInputConfig;
14
14
  plejdService?: PlejdService;
15
15
  readonly accessories: PlatformAccessory[];
16
16
  readonly plejdHandlers: PlejdPlatformAccessoryHandler[];
17
- constructor(log: Logger, config: PlatformConfig, api: API);
17
+ constructor(log: Logger, config: PlatformConfig, homebridgeApi: API);
18
18
  configurePlejd: () => void;
19
19
  configureDevices: (log: Logger, config: PlatformConfig, site?: Site) => void;
20
20
  /**
@@ -27,4 +27,3 @@ export declare class PlejdPlatform implements DynamicPlatformPlugin {
27
27
  onPlejdUpdates: (identifier: number, isOn: boolean, brightness?: number) => void;
28
28
  private generateId;
29
29
  }
30
- //# sourceMappingURL=plejdPlatform.d.ts.map
@@ -1,211 +1,213 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PlejdPlatform = void 0;
7
- const settings_1 = require("./settings");
8
- const plejdPlatformAccessory_1 = require("./plejdPlatformAccessory");
9
- const plejdService_1 = require("./plejdService");
10
- const plejdApi_1 = __importDefault(require("./plejdApi"));
11
- class PlejdPlatform {
12
- constructor(log, config, api) {
1
+ import { PLATFORM_NAME, PLEJD_ADDONS, PLEJD_LIGHTS, PLUGIN_NAME, } from "./settings";
2
+ import { PlejdPlatformAccessoryHandler } from "./plejdPlatformAccessory";
3
+ import { PlejdService } from "./plejdService";
4
+ import PlejdRemoteApi from "./plejdApi";
5
+ export class PlejdPlatform {
6
+ log;
7
+ config;
8
+ homebridgeApi;
9
+ Service;
10
+ Characteristic;
11
+ userInputConfig;
12
+ plejdService;
13
+ // this is used to track restored cached accessories
14
+ accessories = [];
15
+ plejdHandlers = [];
16
+ constructor(log, config, homebridgeApi) {
13
17
  this.log = log;
14
18
  this.config = config;
15
- this.api = api;
16
- this.Service = this.api.hap.Service;
17
- this.Characteristic = this.api.hap.Characteristic;
18
- // this is used to track restored cached accessories
19
- this.accessories = [];
20
- this.plejdHandlers = [];
21
- this.configurePlejd = () => {
22
- if (this.config.password && this.config.site && this.config.username) {
23
- this.log.info('Using login information to fetch devices & crypto key');
24
- this.log.info('Any devices added manually will update the downloaded devices');
25
- const pApi = new plejdApi_1.default(this.log, this.config.site, this.config.username, this.config.password, true);
26
- pApi
27
- .getPlejdRemoteSite()
28
- .then((site) => this.configureDevices(this.log, this.config, site))
29
- .catch((e) => this.log.error(`Plejd remote access error: ${e}`));
30
- }
31
- else if (this.config.crypto_key &&
32
- this.config.devices &&
33
- this.config.devices.count > 0) {
34
- this.log.info('Using supplied crypto key & devices');
35
- this.configureDevices(this.log, this.config, undefined);
36
- }
37
- else {
38
- this.log.warn('No settings are prepared, either supply crypto key & devices OR username, password & site');
39
- }
40
- };
41
- this.configureDevices = (log, config, site) => {
42
- const devices = config.devices || [];
43
- if (site) {
44
- config.crypto_key = site.plejdMesh.cryptoKey;
45
- const items = [];
46
- // Extract devices
47
- site.devices.forEach((item) => {
48
- const name = item.title;
49
- const id = item.deviceId;
50
- const e = site.plejdDevices.find((x) => x.deviceId === id);
51
- const dim = e.firmware.notes;
52
- if (settings_1.PLEJD_ADDONS.includes(dim)) {
53
- return;
54
- }
55
- const room = site.rooms.find((x) => x.roomId === item.roomId);
56
- let identifier = site.inputAddress[id][0];
57
- if (dim.endsWith('-02') &&
58
- items.find((a) => a.identifier === identifier) !== undefined) {
59
- identifier += 1;
60
- }
61
- const res = {
62
- name: name,
63
- model: dim,
64
- identifier: identifier,
65
- isDimmer: settings_1.PLEJD_LIGHTS.includes(dim),
66
- uuid: this.generateId(identifier.toString()),
67
- room: room === null || room === void 0 ? void 0 : room.title,
68
- hidden: false,
69
- };
70
- items.push(res);
71
- });
72
- items.forEach((item) => {
73
- const pre = devices.findIndex((x) => x.identifier === item.identifier);
74
- if (pre !== -1) {
75
- if (devices[pre].hidden) {
76
- log.debug('Hiding device |', devices[pre]);
77
- devices.splice(pre);
78
- }
79
- else {
80
- devices[pre].name = item.name;
81
- }
19
+ this.homebridgeApi = homebridgeApi;
20
+ this.log.debug("Finished initializing platform:", this.config.platform);
21
+ homebridgeApi.on("didFinishLaunching", this.configurePlejd);
22
+ this.Characteristic = homebridgeApi.hap.Characteristic;
23
+ this.Service = homebridgeApi.hap.Service;
24
+ }
25
+ configurePlejd = () => {
26
+ if (this.config.password && this.config.site && this.config.username) {
27
+ this.log.info("Using login information to fetch devices & crypto key");
28
+ this.log.info("Any devices added manually will update the downloaded devices");
29
+ const pApi = new PlejdRemoteApi(this.log, this.config.site, this.config.username, this.config.password, true);
30
+ pApi
31
+ .getPlejdRemoteSite()
32
+ .then((site) => this.configureDevices(this.log, this.config, site))
33
+ .catch((e) => this.log.error(`Plejd remote access error: ${e}`));
34
+ }
35
+ else if (this.config.crypto_key &&
36
+ this.config.devices &&
37
+ this.config.devices.count > 0) {
38
+ this.log.info("Using supplied crypto key & devices");
39
+ this.configureDevices(this.log, this.config, undefined);
40
+ }
41
+ else {
42
+ this.log.warn("No settings are prepared, either supply crypto key & devices OR username, password & site");
43
+ }
44
+ };
45
+ configureDevices = (log, config, site) => {
46
+ const devices = config.devices || [];
47
+ if (site) {
48
+ config.crypto_key = site.plejdMesh.cryptoKey;
49
+ const items = [];
50
+ // Extract devices
51
+ site.devices.forEach((item) => {
52
+ const name = item.title;
53
+ const id = item.deviceId;
54
+ const e = site.plejdDevices.find((x) => x.deviceId === id);
55
+ const dim = e.firmware.notes;
56
+ if (PLEJD_ADDONS.includes(dim)) {
57
+ return;
58
+ }
59
+ const room = site.rooms.find((x) => x.roomId === item.roomId);
60
+ let identifier = site.inputAddress[id][0];
61
+ if (dim.endsWith("-02") &&
62
+ items.find((a) => a.identifier === identifier) !== undefined) {
63
+ identifier += 1;
64
+ }
65
+ const res = {
66
+ name: name,
67
+ model: dim,
68
+ identifier: identifier,
69
+ isDimmer: PLEJD_LIGHTS.includes(dim),
70
+ uuid: this.generateId(identifier.toString()),
71
+ room: room?.title,
72
+ hidden: false,
73
+ };
74
+ items.push(res);
75
+ });
76
+ items.forEach((item) => {
77
+ const pre = devices.findIndex((x) => x.identifier === item.identifier);
78
+ if (pre !== -1) {
79
+ if (devices[pre].hidden) {
80
+ log.debug("Hiding device |", devices[pre]);
81
+ devices.splice(pre);
82
82
  }
83
83
  else {
84
- devices.push(item);
84
+ devices[pre].name = item.name;
85
85
  }
86
- });
87
- }
88
- for (let i = 0; i < devices.length; i++) {
89
- if (devices[i].model) {
90
- devices[i].isDimmer = settings_1.PLEJD_LIGHTS.includes(devices[i].model);
91
86
  }
92
87
  else {
93
- log.error('Missing device model |', devices[i].name);
94
- }
95
- if (devices[i].identifier) {
96
- devices[i].uuid = this.generateId(devices[i].identifier.toString());
97
- }
98
- else {
99
- log.error('Missing device identifier |', devices[i].name);
88
+ devices.push(item);
100
89
  }
90
+ });
91
+ }
92
+ for (let i = 0; i < devices.length; i++) {
93
+ if (devices[i].model) {
94
+ devices[i].isDimmer = PLEJD_LIGHTS.includes(devices[i].model);
101
95
  }
102
- if (!config.crypto_key) {
103
- log.error('No Crypto key was found in the configuration. Check the plugin documentation for more info');
96
+ else {
97
+ log.error("Missing device model |", devices[i].name);
104
98
  }
105
- const cryptoKey = Buffer.from(config.crypto_key.replace(/-/g, ''), 'hex');
106
- this.userInputConfig = {
107
- devices: devices,
108
- cryptoKey: cryptoKey,
109
- };
110
- log.info('Plejd Crypto Key:', config.crypto_key);
111
- log.info('Plejd Devices connected to HomeKit:', this.userInputConfig.devices);
112
- this.plejdService = new plejdService_1.PlejdService(this.userInputConfig, log, this.onPlejdUpdates.bind(this));
113
- this.discoverDevices();
114
- };
115
- /**
116
- * This function is invoked when homebridge restores cached accessories from disk at startup.
117
- * It should be used to setup event handlers for characteristics and update respective values.
118
- */
119
- this.configureAccessory = (accessory) => {
120
- this.log.info('Loading accessory from cache | ', accessory.displayName);
121
- this.accessories.push(accessory);
122
- };
123
- this.discoverDevices = () => {
124
- var _a;
125
- const units = this.userInputConfig.devices.map((x) => x.uuid);
126
- const notRegistered = this.accessories.filter((ac) => !units.includes(ac.UUID));
127
- if (notRegistered.length > 0) {
128
- this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, notRegistered);
99
+ if (devices[i].identifier) {
100
+ devices[i].uuid = this.generateId(devices[i].identifier.toString());
129
101
  }
130
- this.log.debug('registering devices', (_a = this.userInputConfig) === null || _a === void 0 ? void 0 : _a.devices);
131
- for (const device of this.userInputConfig.devices) {
132
- if (device.hidden) {
133
- continue;
134
- }
135
- const existingAccessory = this.accessories.find((accessory) => accessory.UUID === device.uuid);
136
- if (existingAccessory) {
137
- this.plejdHandlers.push(new plejdPlatformAccessory_1.PlejdPlatformAccessoryHandler(this, existingAccessory, device));
138
- }
139
- else {
140
- this.addNewDevice(device);
141
- }
102
+ else {
103
+ log.error("Missing device identifier |", devices[i].name);
142
104
  }
105
+ }
106
+ if (!config.crypto_key) {
107
+ log.error("No Crypto key was found in the configuration. Check the plugin documentation for more info");
108
+ }
109
+ const cryptoKey = Buffer.from(config.crypto_key.replace(/-/g, ""), "hex");
110
+ this.userInputConfig = {
111
+ devices: devices,
112
+ cryptoKey: cryptoKey,
143
113
  };
144
- this.addNewDevice = (device) => {
145
- let name = device.name;
146
- this.log.info('Adding new accessory |', name);
147
- if (device.room) {
148
- name = device.room + ' - ' + name;
114
+ log.info("Plejd Crypto Key:", config.crypto_key);
115
+ log.info("Plejd Devices connected to HomeKit:", this.userInputConfig.devices);
116
+ this.plejdService = new PlejdService(this.userInputConfig, log, this.onPlejdUpdates.bind(this));
117
+ this.discoverDevices();
118
+ };
119
+ /**
120
+ * This function is invoked when homebridge restores cached accessories from disk at startup.
121
+ * It should be used to setup event handlers for characteristics and update respective values.
122
+ */
123
+ configureAccessory = (accessory) => {
124
+ this.log.info("Loading accessory from cache | ", accessory.displayName);
125
+ this.accessories.push(accessory);
126
+ };
127
+ discoverDevices = () => {
128
+ const units = this.userInputConfig.devices.map((x) => x.uuid);
129
+ const notRegistered = this.accessories.filter((ac) => !units.includes(ac.UUID));
130
+ if (notRegistered.length > 0) {
131
+ this.homebridgeApi.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, notRegistered);
132
+ }
133
+ this.log.debug("registering devices", this.userInputConfig?.devices);
134
+ for (const device of this.userInputConfig.devices) {
135
+ if (device.hidden) {
136
+ continue;
149
137
  }
150
- const accessory = new this.api.platformAccessory(device.name, device.uuid);
151
- accessory.context.device = device;
152
- // See above.
153
- this.plejdHandlers.push(new plejdPlatformAccessory_1.PlejdPlatformAccessoryHandler(this, accessory, device));
154
- // link the accessory to your platform
155
- this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [
156
- accessory,
157
- ]);
158
- if (!this.accessories.find((x) => x.UUID === device.uuid)) {
159
- this.accessories.push(accessory);
138
+ const existingAccessory = this.accessories.find((accessory) => accessory.UUID === device.uuid);
139
+ if (existingAccessory) {
140
+ this.plejdHandlers.push(new PlejdPlatformAccessoryHandler(this, existingAccessory, device));
160
141
  }
161
- };
162
- this.onPlejdUpdates = (identifier, isOn, brightness) => {
163
- var _a, _b, _c;
164
- const uuid = (_a = this.userInputConfig.devices.find((d) => d.identifier === identifier)) === null || _a === void 0 ? void 0 : _a.uuid;
165
- if (uuid === undefined) {
166
- // Scene or Room, eg: Unused
167
- return;
142
+ else {
143
+ this.addNewDevice(device);
168
144
  }
169
- const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
170
- const device = this.userInputConfig.devices.find((dev) => dev.identifier === identifier);
171
- const plejdHandler = this.plejdHandlers.find((dev) => dev.device.identifier === identifier);
172
- if (existingAccessory && device && plejdHandler) {
173
- if (device.isDimmer) {
174
- const ser = existingAccessory.getService(this.Service.Lightbulb);
175
- if (!ser) {
176
- this.log.warn('Unable to get service');
177
- }
178
- const on = ser === null || ser === void 0 ? void 0 : ser.getCharacteristic(this.Characteristic.On);
179
- if (!on) {
180
- this.log.warn('Unable to get Characteristic [On]');
181
- }
182
- on === null || on === void 0 ? void 0 : on.updateValue(isOn);
183
- if (brightness !== undefined) {
184
- ser === null || ser === void 0 ? void 0 : ser.getCharacteristic(this.Characteristic.Brightness).updateValue(brightness);
185
- }
145
+ }
146
+ };
147
+ addNewDevice = (device) => {
148
+ let name = device.name;
149
+ this.log.info("Adding new accessory |", name);
150
+ if (device.room) {
151
+ name = device.room + " - " + name;
152
+ }
153
+ const accessory = new this.homebridgeApi.platformAccessory(device.name, device.uuid);
154
+ accessory.context.device = device;
155
+ // See above.
156
+ this.plejdHandlers.push(new PlejdPlatformAccessoryHandler(this, accessory, device));
157
+ // link the accessory to your platform
158
+ this.homebridgeApi.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [
159
+ accessory,
160
+ ]);
161
+ if (!this.accessories.find((x) => x.UUID === device.uuid)) {
162
+ this.accessories.push(accessory);
163
+ }
164
+ };
165
+ onPlejdUpdates = (identifier, isOn, brightness) => {
166
+ const uuid = this.userInputConfig.devices.find((d) => d.identifier === identifier)?.uuid;
167
+ if (uuid === undefined) {
168
+ // Scene or Room, eg: Unused
169
+ return;
170
+ }
171
+ const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
172
+ const device = this.userInputConfig.devices.find((dev) => dev.identifier === identifier);
173
+ const plejdHandler = this.plejdHandlers.find((dev) => dev.device.identifier === identifier);
174
+ if (existingAccessory && device && plejdHandler) {
175
+ if (device.isDimmer) {
176
+ const ser = existingAccessory.getService(this.Service.Lightbulb);
177
+ if (!ser) {
178
+ this.log.warn("Unable to get service");
186
179
  }
187
- else {
188
- (_c = (_b = existingAccessory
189
- .getService(this.Service.Switch)) === null || _b === void 0 ? void 0 : _b.getCharacteristic(this.Characteristic.On)) === null || _c === void 0 ? void 0 : _c.updateValue(isOn);
180
+ const on = ser?.getCharacteristic(this.Characteristic.On);
181
+ if (!on) {
182
+ this.log.warn("Unable to get Characteristic [On]");
183
+ }
184
+ on?.updateValue(isOn);
185
+ if (brightness !== undefined) {
186
+ ser
187
+ ?.getCharacteristic(this.Characteristic.Brightness)
188
+ .updateValue(brightness);
190
189
  }
191
- plejdHandler.updateState(isOn, brightness);
192
190
  }
193
191
  else {
194
- if (device) {
195
- this.addNewDevice(device);
196
- this.onPlejdUpdates(identifier, isOn, brightness);
197
- }
198
- else {
199
- this.log.info('Unable find HomKit device associated with incoming Plejd update |', device);
200
- }
192
+ existingAccessory
193
+ .getService(this.Service.Switch)
194
+ ?.getCharacteristic(this.Characteristic.On)
195
+ ?.updateValue(isOn);
201
196
  }
202
- };
203
- this.generateId = (input) => {
204
- return this.api.hap.uuid.generate(input);
205
- };
206
- this.log.debug('Finished initializing platform:', this.config.platform);
207
- api.on('didFinishLaunching', this.configurePlejd);
208
- }
197
+ plejdHandler.updateState(isOn, brightness);
198
+ }
199
+ else {
200
+ if (device) {
201
+ this.addNewDevice(device);
202
+ this.onPlejdUpdates(identifier, isOn, brightness);
203
+ }
204
+ else {
205
+ this.log.info("Unable find HomKit device associated with incoming Plejd update |", device);
206
+ }
207
+ }
208
+ };
209
+ generateId = (input) => {
210
+ return this.homebridgeApi.hap.uuid.generate(input);
211
+ };
209
212
  }
210
- exports.PlejdPlatform = PlejdPlatform;
211
213
  //# sourceMappingURL=plejdPlatform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plejdPlatform.js","sourceRoot":"","sources":["../src/plejdPlatform.ts"],"names":[],"mappings":";;;;;;AAUA,yCAKoB;AACpB,qEAAyE;AAGzE,iDAA8C;AAC9C,0DAAwC;AAGxC,MAAa,aAAa;IAaxB,YACkB,GAAW,EACX,MAAsB,EACtB,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QAfV,YAAO,GAAmB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,mBAAc,GAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAK9B,oDAAoD;QACpC,gBAAW,GAAwB,EAAE,CAAC;QAEtC,kBAAa,GAAoC,EAAE,CAAC;QAYpE,mBAAc,GAAG,GAAG,EAAE;YACpB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACpE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;gBACvE,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,+DAA+D,CAChE,CAAC;gBAEF,MAAM,IAAI,GAAG,IAAI,kBAAc,CAC7B,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,MAAM,CAAC,IAAI,EAChB,IAAI,CAAC,MAAM,CAAC,QAAQ,EACpB,IAAI,CAAC,MAAM,CAAC,QAAQ,EACpB,IAAI,CACL,CAAC;gBACF,IAAI;qBACD,kBAAkB,EAAE;qBACpB,IAAI,CAAC,CAAC,IAAI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,CAAC,MAAM,CAAC;oBAChC,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;oBAC3C,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;YAED,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBAC1B,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,mEAAmE,EACnE,MAAM,CACP,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE;QAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC;CACH"}
@@ -19,4 +19,3 @@ export declare class PlejdPlatformAccessoryHandler {
19
19
  private setBrightness;
20
20
  private getBrightness;
21
21
  }
22
- //# sourceMappingURL=plejdPlatformAccessory.d.ts.map
@@ -1,65 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlejdPlatformAccessoryHandler = void 0;
4
- const settings_1 = require("./settings");
1
+ import { PLATFORM_NAME } from './settings';
5
2
  /**
6
3
  * Platform Accessory
7
4
  * An instance of this class is created for each accessory your platform registers
8
5
  * Each accessory may expose multiple services of different service types.
9
6
  */
10
- class PlejdPlatformAccessoryHandler {
7
+ export class PlejdPlatformAccessoryHandler {
8
+ platform;
9
+ accessory;
10
+ device;
11
+ service;
12
+ state;
11
13
  constructor(platform, accessory, device) {
12
- var _a, _b;
13
14
  this.platform = platform;
14
15
  this.accessory = accessory;
15
16
  this.device = device;
16
- this.updateState = (isOn, brightness) => {
17
- this.state.isOn = isOn;
18
- this.platform.log.debug('updateState | Sending isOn', isOn);
19
- this.service
20
- .getCharacteristic(this.platform.Characteristic.On)
21
- .updateValue(isOn);
22
- if (brightness) {
23
- this.state.brightness = Math.round(brightness);
24
- this.platform.log.debug('update state | Sending brightness', this.state.brightness);
25
- this.service
26
- .getCharacteristic(this.platform.Characteristic.Brightness)
27
- .updateValue(this.state.brightness);
28
- }
29
- this.accessory.context = this.state;
30
- this.platform.log.debug(`State updated | ${JSON.stringify(this.state)}`);
31
- };
32
- this.setOn = async (value) => {
33
- var _a;
34
- const newVal = value;
35
- this.platform.log.info(`Updating state | ${this.device.name} | to ${newVal ? 'On' : 'off'} | from ${this.state.isOn ? 'On' : 'Off'}`);
36
- this.updateState(newVal, this.state.brightness);
37
- (_a = this.platform.plejdService) === null || _a === void 0 ? void 0 : _a.updateState(this.device.identifier, newVal, null);
38
- };
39
- this.getOn = async () => {
40
- this.platform.log.debug('Get Characteristic On', this.device.name, this.state.isOn);
41
- return this.state.isOn;
42
- };
43
- this.setBrightness = async (value) => {
44
- var _a;
45
- const newVal = value; // Number between 1-100
46
- this.platform.log.debug(`Updating brightness | ${this.device.name} | to ${newVal} | from ${this.state.brightness}`);
47
- this.updateState(this.state.isOn, newVal);
48
- (_a = this.platform.plejdService) === null || _a === void 0 ? void 0 : _a.updateState(this.device.identifier, this.state.isOn, newVal);
49
- };
50
- this.getBrightness = async () => {
51
- this.platform.log.debug('Get Characteristic Brightness', this.device.name, this.state.brightness);
52
- return this.state.brightness;
53
- };
54
17
  platform.log.debug(`Adding handler for a ${this.device.model} with id ${this.device.identifier}`);
55
18
  this.state = {
56
- brightness: (_a = accessory.context.brightness) !== null && _a !== void 0 ? _a : 100,
57
- isOn: (_b = accessory.context.isOn) !== null && _b !== void 0 ? _b : false,
19
+ brightness: accessory.context.brightness ?? 100,
20
+ isOn: accessory.context.isOn ?? false,
58
21
  };
59
22
  // set accessory information
60
23
  this.accessory
61
24
  .getService(this.platform.Service.AccessoryInformation)
62
- .setCharacteristic(this.platform.Characteristic.Manufacturer, settings_1.PLATFORM_NAME)
25
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, PLATFORM_NAME)
63
26
  .setCharacteristic(this.platform.Characteristic.Model, this.device.model)
64
27
  .setCharacteristic(this.platform.Characteristic.SerialNumber, this.device.identifier.toString());
65
28
  if (this.device.isDimmer) {
@@ -84,6 +47,41 @@ class PlejdPlatformAccessoryHandler {
84
47
  .onGet(this.getOn.bind(this));
85
48
  this.service.setCharacteristic(this.platform.Characteristic.Name, this.device.name);
86
49
  }
50
+ updateState = (isOn, brightness) => {
51
+ this.state.isOn = isOn;
52
+ this.platform.log.debug('updateState | Sending isOn', isOn);
53
+ this.service
54
+ .getCharacteristic(this.platform.Characteristic.On)
55
+ .updateValue(isOn);
56
+ if (brightness) {
57
+ this.state.brightness = Math.round(brightness);
58
+ this.platform.log.debug('update state | Sending brightness', this.state.brightness);
59
+ this.service
60
+ .getCharacteristic(this.platform.Characteristic.Brightness)
61
+ .updateValue(this.state.brightness);
62
+ }
63
+ this.accessory.context = this.state;
64
+ this.platform.log.debug(`State updated | ${JSON.stringify(this.state)}`);
65
+ };
66
+ setOn = async (value) => {
67
+ const newVal = value;
68
+ this.platform.log.info(`Updating state | ${this.device.name} | to ${newVal ? 'On' : 'off'} | from ${this.state.isOn ? 'On' : 'Off'}`);
69
+ this.updateState(newVal, this.state.brightness);
70
+ this.platform.plejdService?.updateState(this.device.identifier, newVal, null);
71
+ };
72
+ getOn = async () => {
73
+ this.platform.log.debug('Get Characteristic On', this.device.name, this.state.isOn);
74
+ return this.state.isOn;
75
+ };
76
+ setBrightness = async (value) => {
77
+ const newVal = value; // Number between 1-100
78
+ this.platform.log.debug(`Updating brightness | ${this.device.name} | to ${newVal} | from ${this.state.brightness}`);
79
+ this.updateState(this.state.isOn, newVal);
80
+ this.platform.plejdService?.updateState(this.device.identifier, this.state.isOn, newVal);
81
+ };
82
+ getBrightness = async () => {
83
+ this.platform.log.debug('Get Characteristic Brightness', this.device.name, this.state.brightness);
84
+ return this.state.brightness;
85
+ };
87
86
  }
88
- exports.PlejdPlatformAccessoryHandler = PlejdPlatformAccessoryHandler;
89
87
  //# sourceMappingURL=plejdPlatformAccessory.js.map