homebridge-gree-ac 2.1.1 → 2.1.3

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/platform.js CHANGED
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.GreeACPlatform = void 0;
7
7
  const dgram_1 = __importDefault(require("dgram"));
8
8
  const crypto_1 = __importDefault(require("./crypto"));
9
+ const os_1 = require("os");
9
10
  const settings_1 = require("./settings");
10
11
  const platformAccessory_1 = require("./platformAccessory");
11
12
  const tsAccessory_1 = require("./tsAccessory");
12
13
  const commands_1 = __importDefault(require("./commands"));
14
+ const version_1 = require("./version");
13
15
  /**
14
16
  * HomebridgePlatform
15
17
  * This class is the main constructor for your plugin, this is where you should
@@ -22,6 +24,7 @@ class GreeACPlatform {
22
24
  this.api = api;
23
25
  this.Service = this.api.hap.Service;
24
26
  this.Characteristic = this.api.hap.Characteristic;
27
+ this.pluginAddresses = {};
25
28
  this.handleMessage = (msg, rinfo) => {
26
29
  this.log.debug('handleMessage -> %s', msg.toString());
27
30
  try {
@@ -30,11 +33,11 @@ class GreeACPlatform {
30
33
  message = JSON.parse(msg.toString());
31
34
  }
32
35
  catch (e) {
33
- this.log.debug('handleMessage - unknown message - BASE64 encoded message: %s', Buffer.from(msg).toString('base64'));
36
+ this.log.debug('handleMessage - unknown message from %s - BASE64 encoded message: %s', rinfo.address.toString(), Buffer.from(msg).toString('base64'));
34
37
  return;
35
38
  }
36
39
  if (message.i !== 1 || message.t !== 'pack') {
37
- this.log.debug('handleMessage - unknown response: %j', message);
40
+ this.log.debug('handleMessage - unknown response from %s: %j', rinfo.address.toString(), message);
38
41
  return;
39
42
  }
40
43
  let pack, encryptionVersion;
@@ -62,23 +65,24 @@ class GreeACPlatform {
62
65
  });
63
66
  }
64
67
  else {
65
- this.log.debug('handleMessage - unknown package: %j', pack);
68
+ this.log.debug('handleMessage - unknown package from %s: %j', rinfo.address.toString(), pack);
66
69
  }
67
70
  }
68
71
  catch (err) {
69
72
  const msg = err.message;
70
- this.log.error('handleMessage - Error:', msg);
73
+ this.log.error('handleMessage (%s) - Error: %s', rinfo.address.toString(), msg);
71
74
  }
72
75
  };
73
76
  this.registerDevice = (deviceInfo) => {
74
77
  var _a, _b;
78
+ this.log.debug('registerDevice - deviceInfo:', JSON.stringify(deviceInfo));
75
79
  const devcfg = this.config.devices.find((item) => item.mac === deviceInfo.mac) || {};
76
80
  const deviceConfig = {
77
81
  ...devcfg,
78
82
  ...((devcfg.speedSteps && devcfg.speedSteps !== 3 && devcfg.speedSteps !== 5) || devcfg.speedSteps === 0 ?
79
83
  { speedSteps: 5 } : {}),
80
- ...((devcfg.temperatureSensor && ['disabled', 'child', 'separate'].includes(devcfg.temperatureSensor.toLowerCase())) ?
81
- { temperatureSensor: devcfg.temperatureSensor.toLowerCase() } : { temperatureSensor: 'disabled' }),
84
+ ...((devcfg.temperatureSensor && Object.values(settings_1.TS_TYPE).includes(devcfg.temperatureSensor.toLowerCase())) ?
85
+ { temperatureSensor: devcfg.temperatureSensor.toLowerCase() } : { temperatureSensor: settings_1.TS_TYPE.disabled }),
82
86
  ...(devcfg.minimumTargetTemperature && (devcfg.minimumTargetTemperature < settings_1.DEFAULT_DEVICE_CONFIG.minimumTargetTemperature ||
83
87
  devcfg.minimumTargetTemperature > settings_1.DEFAULT_DEVICE_CONFIG.maximumTargetTemperature) ?
84
88
  { minimumTargetTemperature: settings_1.DEFAULT_DEVICE_CONFIG.minimumTargetTemperature } : {}),
@@ -99,6 +103,12 @@ class GreeACPlatform {
99
103
  deviceConfig[key] = value;
100
104
  }
101
105
  });
106
+ if (deviceConfig.port !== undefined && (typeof deviceConfig.port !== 'number' || deviceConfig.port !== deviceConfig.port ||
107
+ (typeof deviceConfig.port === 'number' && (deviceConfig.port < 1025 || deviceConfig.port > 65535)))) {
108
+ this.log.warn('Warning: Port is misconfigured (Valid port values: 1025~65535 or leave port empty to auto select) - ' +
109
+ `Accessory ${deviceInfo.mac} listening port overridden: ${deviceConfig.port} -> auto`);
110
+ deviceConfig.port = undefined;
111
+ }
102
112
  // force encryption version if set in config
103
113
  if (deviceConfig.encryptionVersion !== settings_1.ENCRYPTION_VERSION.auto) {
104
114
  deviceInfo.encryptionVersion = deviceConfig.encryptionVersion;
@@ -108,76 +118,125 @@ class GreeACPlatform {
108
118
  let accessory_ts = this.devices[deviceInfo.mac + '_ts'];
109
119
  if ((deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.disabled) || !/^[a-f0-9]{12}$/.test(deviceConfig.mac)) {
110
120
  if (!this.skippedDevices[deviceInfo.mac]) {
111
- this.log.info(`Accessory ${deviceInfo.mac} skipped`);
121
+ this.log.info(`Accessory ${deviceInfo.mac}${devcfg.mac === undefined ? ' not configured -' : ''} skipped`);
112
122
  this.skippedDevices[deviceInfo.mac] = true;
113
123
  }
124
+ else {
125
+ this.log.debug(`Accessory ${deviceInfo.mac}${devcfg.mac === undefined ? ' not configured -' : ''} skipped`);
126
+ }
114
127
  if (accessory) {
128
+ delete this.devices[accessory.context.deviceInfo.mac];
115
129
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
116
- delete this.devices[deviceConfig.mac];
130
+ this.log.debug(`registerDevice - unregister (${devcfg.mac === undefined ? 'not configured' : 'disabled'}):`, accessory.displayName, accessory.UUID);
131
+ accessory = undefined;
117
132
  }
118
133
  if (accessory_ts) {
134
+ delete this.devices[accessory_ts.context.deviceInfo.mac];
119
135
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
120
- delete this.devices[deviceConfig.mac + '_ts'];
136
+ this.log.debug(`registerDevice - unregister (${devcfg.mac === undefined ? 'not configured' : 'disabled'}):`, accessory_ts.displayName, accessory_ts.UUID);
137
+ accessory_ts = undefined;
121
138
  }
122
139
  return;
123
140
  }
141
+ // check device address change
142
+ if (accessory && deviceInfo.address !== accessory.context.device.address) {
143
+ this.log.info(`Device [${accessory.displayName} - ${accessory.context.device.mac}] address has changed: %s -> %s`, accessory.context.device.address, deviceInfo.address);
144
+ accessory.context.device.address = deviceInfo.address;
145
+ }
146
+ if (accessory_ts && deviceInfo.address !== accessory_ts.context.device.address) {
147
+ accessory_ts.context.device.address = deviceInfo.address;
148
+ }
124
149
  if (accessory && this.initializedDevices[accessory.UUID]) {
125
150
  // already initalized
151
+ this.log.debug('registerDevice - already initalized:', accessory.displayName, accessory.UUID, accessory.context.device.mac);
126
152
  return;
127
153
  }
154
+ // register heatercooler accessory
155
+ const deviceName = (_a = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _a !== void 0 ? _a : (deviceInfo.name || deviceInfo.mac);
128
156
  if (!accessory) {
129
- const deviceName = (_a = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _a !== void 0 ? _a : (deviceInfo.name || deviceInfo.mac);
130
- this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName}...`);
157
+ this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName} ...`);
131
158
  const uuid = this.api.hap.uuid.generate(deviceInfo.mac);
132
159
  accessory = new this.api.platformAccessory(deviceName, uuid, 21 /* Categories.AIR_CONDITIONER */);
133
160
  this.devices[deviceInfo.mac] = accessory;
134
161
  this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
135
162
  }
136
- if (!accessory_ts && deviceConfig.temperatureSensor === 'separate') {
137
- const deviceName_ts = 'Temperature Sensor - ' + ((_b = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _b !== void 0 ? _b : (deviceInfo.name || deviceInfo.mac));
138
- this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName_ts}...`);
163
+ // register temperaturesensor accessory if configured as separate
164
+ const tsDeviceName = 'Temperature Sensor - ' + ((_b = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _b !== void 0 ? _b : (deviceInfo.name || deviceInfo.mac));
165
+ if (!accessory_ts && deviceConfig.temperatureSensor === settings_1.TS_TYPE.separate) {
166
+ this.log.debug(`Initializing new accessory ${deviceInfo.mac}_ts with name ${tsDeviceName} ...`);
139
167
  const uuid = this.api.hap.uuid.generate(deviceInfo.mac + '_ts');
140
- accessory_ts = new this.api.platformAccessory(deviceName_ts, uuid, 10 /* Categories.SENSOR */);
168
+ accessory_ts = new this.api.platformAccessory(tsDeviceName, uuid, 10 /* Categories.SENSOR */);
141
169
  this.devices[deviceInfo.mac + '_ts'] = accessory_ts;
142
170
  this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
143
171
  }
144
- if (accessory_ts && deviceConfig.temperatureSensor !== 'separate') {
172
+ // unregister temperaturesensor accessory if configuration has changed from separate to any other
173
+ if (accessory_ts && deviceConfig.temperatureSensor !== settings_1.TS_TYPE.separate) {
145
174
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
146
- delete this.devices[deviceConfig.mac + '_ts'];
175
+ delete this.devices[deviceInfo.mac + '_ts'];
176
+ this.log.debug('registerDevice - unregister:', accessory_ts.displayName, accessory_ts.UUID);
177
+ accessory_ts = undefined;
147
178
  }
148
- let tsService;
149
- if (accessory_ts && deviceConfig.temperatureSensor === 'separate') {
150
- // mark temperature sensor devices as initialized
151
- accessory_ts.context.device = deviceInfo;
179
+ let tsService = null;
180
+ if (accessory_ts && deviceConfig.temperatureSensor === settings_1.TS_TYPE.separate) {
181
+ // mark temperature sensor device as initialized
182
+ accessory_ts.context.device = { ...deviceInfo };
183
+ accessory_ts.context.device.mac = deviceInfo.mac + '_ts';
152
184
  accessory_ts.context.deviceType = 'TemperatureSensor';
185
+ accessory_ts.displayName = tsDeviceName;
153
186
  this.initializedDevices[accessory_ts.UUID] = true;
154
187
  tsService = new tsAccessory_1.GreeAirConditionerTS(this, accessory_ts, deviceConfig);
188
+ this.log.debug(`registerDevice - ${accessory_ts.context.deviceType} initialized:`, accessory_ts.displayName, accessory_ts.context.device.mac, accessory_ts.UUID);
155
189
  }
156
190
  if (accessory) {
157
- // mark devices as initialized
191
+ // mark heatercooler device as initialized
158
192
  accessory.context.device = deviceInfo;
159
193
  accessory.context.deviceType = 'HeaterCooler';
160
- accessory.context.accessory_ts = accessory_ts;
161
- accessory.context.bound = false;
194
+ accessory.displayName = deviceName;
162
195
  this.initializedDevices[accessory.UUID] = true;
163
- return new platformAccessory_1.GreeAirConditioner(this, accessory, deviceConfig, this.config.port, tsService);
196
+ this.log.debug(`registerDevice - ${accessory.context.deviceType} initialized:`, accessory.displayName, accessory.context.device.mac, accessory.UUID);
197
+ new platformAccessory_1.GreeAirConditioner(this, accessory, deviceConfig, this.config.port, tsService);
198
+ }
199
+ // update registered accessories at the end of initialization
200
+ const accessories = [accessory];
201
+ if (accessory_ts) {
202
+ accessories.push(accessory_ts);
164
203
  }
204
+ this.api.updatePlatformAccessories(accessories);
165
205
  };
166
- this.socket = dgram_1.default.createSocket({ type: 'udp4', reuseAddr: true });
167
206
  this.devices = {};
168
207
  this.initializedDevices = {};
169
208
  this.skippedDevices = {};
170
- this.scanCount = 0;
171
- this.log.debug('Finished initializing platform:', this.config.name);
209
+ this.pluginAddresses = this.getNetworkAddresses();
210
+ if (Object.entries(this.pluginAddresses).length > 0) {
211
+ this.log.debug('Device detection address list {(address : netmask) pairs}:', this.pluginAddresses);
212
+ }
213
+ else {
214
+ this.log.error('Error: Homebridge host has no IPv4 address');
215
+ }
216
+ // if no IPv4 address found we create socket for IPv6
217
+ this.socket = dgram_1.default.createSocket({ type: (Object.entries(this.pluginAddresses).length > 0) ? 'udp4' : 'udp6', reuseAddr: true });
218
+ this.socket.on('error', (err) => {
219
+ this.log.error('Network - Error:', err.message);
220
+ });
221
+ this.socket.on('close', () => {
222
+ this.log.debug('Network - Connection closed');
223
+ });
224
+ this.log.debug('Finished initializing platform');
172
225
  // When this event is fired it means Homebridge has restored all cached accessories from disk.
173
226
  // Dynamic Platform plugins should only register new accessories after this event was fired,
174
227
  // in order to ensure they weren't added to homebridge already. This event can also be used
175
228
  // to start discovery of new accessories.
176
229
  this.api.on('didFinishLaunching', () => {
177
230
  log.debug('Executed didFinishLaunching callback');
178
- this.socket.on('message', this.handleMessage);
179
- // run the method to discover / register your devices as accessories
180
- this.discoverDevices();
231
+ if (Object.entries(this.pluginAddresses).length === 0) {
232
+ this.socket.close();
233
+ this.log.error('Network - Error: No IPv4 host address found');
234
+ }
235
+ else {
236
+ this.socket.on('message', this.handleMessage);
237
+ // run the method to discover / register your devices as accessories
238
+ this.discoverDevices();
239
+ }
181
240
  });
182
241
  }
183
242
  /**
@@ -186,73 +245,110 @@ class GreeACPlatform {
186
245
  */
187
246
  configureAccessory(accessory) {
188
247
  var _a;
189
- this.log.debug('Loading accessory from cache: ', accessory.displayName, accessory.context.device);
248
+ this.log.debug('Loading accessory from cache:', accessory.displayName, JSON.stringify(accessory.context.device));
190
249
  // add the restored accessory to the accessories cache so we can track if it has already been registered
191
250
  if ((_a = accessory.context.device) === null || _a === void 0 ? void 0 : _a.mac) {
192
- if (accessory.context.deviceType === undefined || accessory.context.deviceType === 'HeaterCooler') {
193
- // this is the main accessory
194
- this.devices[accessory.context.device.mac] = accessory;
195
- }
196
- if (accessory.context.deviceType === 'TemperatureSensor') {
197
- // this is the temperature sensor
198
- this.devices[accessory.context.device.mac + '_ts'] = accessory;
199
- }
251
+ accessory.context.bound = false;
252
+ this.devices[accessory.context.device.mac] = accessory;
253
+ }
254
+ // clean all invalid accessories found in cache
255
+ if (!accessory.context) {
256
+ this.log.debug('Invalid accessory found in cache - deleting:', accessory.displayName, accessory.UUID);
257
+ this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
200
258
  }
201
259
  }
202
260
  /**
203
261
  * Accessories must only be registered once, previously created accessories
204
262
  * must not be registered again to prevent "duplicate UUID" errors.
205
263
  */
264
+ bindCallback() {
265
+ this.log.info(`${settings_1.PLATFORM_NAME} (${settings_1.PLUGIN_NAME}) v%s is running on UDP port %d`, version_1.version, this.socket.address().port);
266
+ this.socket.setBroadcast(true);
267
+ setInterval(() => {
268
+ this.broadcastScan();
269
+ }, (this.config.scanInterval || settings_1.DEF_SCAN_INTERVAL) * 1000); // scanInterval in seconds (default = 60 sec)
270
+ }
206
271
  discoverDevices() {
207
- if (this.config.port !== undefined && typeof this.config.port === 'number' && this.config.port === this.config.port &&
208
- this.config.port >= 0 && this.config.port <= 65279) {
209
- this.socket.bind(this.config.port, () => {
210
- this.log.info(`UDP server bind to port ${this.config.port}`);
211
- this.socket.setBroadcast(true);
212
- this.timer = setInterval(() => {
213
- this.scanCount += 1;
214
- if (this.scanCount > this.config.scanCount && this.timer) {
215
- this.log.info('Scan finished.');
216
- clearInterval(this.timer);
217
- this.socket.close();
218
- // remove accessories not found on network or not responsing to bind request
219
- Object.entries(this.devices).forEach(([key, value]) => {
220
- if (value && !value.context.bound && this.initializedDevices[value.UUID] &&
221
- (value.context.deviceType === 'HeaterCooler' || value.context.deviceType === undefined)) {
222
- this.log.warn('Warning: Device not bound: %s [%s -- %s:%s]', value.context.device.mac, value.displayName, value.context.device.address, value.context.device.port);
223
- if (value.context.accessory_ts) {
224
- this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [value.context.accessory_ts]);
225
- delete this.initializedDevices[value.context.accessory_ts.UUID];
226
- delete this.devices[value.context.accessory_ts.context.device.mac + '_ts'];
227
- }
228
- this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [value]);
229
- delete this.initializedDevices[value.UUID];
230
- }
231
- if (value && !this.initializedDevices[value.UUID]) {
232
- this.log.debug('Cleanup -> Remove', value.displayName, key, value.UUID);
233
- delete this.devices[key];
234
- }
235
- });
236
- }
237
- else {
238
- this.broadcastScan();
239
- }
240
- }, this.config.scanTimeout * 1000); // scanTimeout in seconds
241
- });
272
+ if (this.config.port === undefined || (this.config.port !== undefined && typeof this.config.port === 'number' &&
273
+ this.config.port === this.config.port && this.config.port >= 1025 && this.config.port <= 65535)) {
274
+ this.socket.bind(this.config.port, undefined, () => this.bindCallback());
242
275
  }
243
276
  else {
244
- this.log.warn('Warning: Port is missing or misconfigured (Valid port values: 1025~65279)');
277
+ this.log.error('Error: Port is misconfigured (Valid port values: 1025~65535 or leave port empty to auto select)');
278
+ this.socket.close();
245
279
  }
246
280
  }
247
281
  broadcastScan() {
248
282
  const message = Buffer.from(JSON.stringify({ t: 'scan' }));
249
- this.socket.send(message, 0, message.length, settings_1.UDP_SCAN_PORT, this.config.scanAddress, (error) => {
250
- this.log.debug(`Broadcast '${message}' ${this.config.scanAddress}:${settings_1.UDP_SCAN_PORT}`);
251
- if (error) {
252
- this.log.error('broadcastScan - Error:', error.message);
253
- }
283
+ Object.entries(this.pluginAddresses).forEach((value) => {
284
+ const addr = value[0];
285
+ this.socket.send(message, 0, message.length, settings_1.UDP_SCAN_PORT, addr, (error) => {
286
+ if (this.pluginAddresses[addr] === '255.255.255.255') {
287
+ this.log.debug(`Querying device '${message}' ${addr}:${settings_1.UDP_SCAN_PORT}`);
288
+ }
289
+ else {
290
+ this.log.debug(`Broadcasting '${message}' ${addr}:${settings_1.UDP_SCAN_PORT}`);
291
+ }
292
+ if (error) {
293
+ this.log.error('Device detection - Error:', error.message);
294
+ }
295
+ });
254
296
  });
255
297
  }
298
+ getNetworkAddresses() {
299
+ this.log.debug('Checking network interfaces');
300
+ const pluginAddresses = {};
301
+ const allInterfaces = (0, os_1.networkInterfaces)();
302
+ for (const name of Object.keys(allInterfaces)) {
303
+ const nets = allInterfaces[name];
304
+ if (nets) {
305
+ for (const iface of nets) {
306
+ // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
307
+ const familyV4Value = typeof iface.family === 'string' ? 'IPv4' : 4;
308
+ if (iface.family === familyV4Value && !iface.internal) {
309
+ const addrParts = iface.address.split('.');
310
+ const netmaskParts = iface.netmask.split('.');
311
+ const broadcast = addrParts.map((e, i) => ((~Number(netmaskParts[i]) & 0xFF) | Number(e)).toString()).join('.');
312
+ this.log.debug('Interface: \'%s\' Address: %s Netmask: %s Broadcast: %s', name, iface.address, iface.netmask, broadcast);
313
+ if (pluginAddresses[broadcast] === undefined) {
314
+ pluginAddresses[broadcast] = iface.netmask;
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ // Add IPs from configuration but only if at least one host address found
321
+ if (Object.keys(pluginAddresses).length > 0) {
322
+ const devcfgs = this.config.devices.filter((item) => item.ip && !item.disabled) || [];
323
+ devcfgs.forEach((value) => {
324
+ const ip = value['ip'];
325
+ const ipv4Pattern = /^(25[0-5]|2[0-4]\d|1\d{2}|\d{1,2})(\.(25[0-5]|2[0-4]\d|1\d{2}|\d{1,2})){3}$/;
326
+ if (ipv4Pattern.test(ip)) {
327
+ this.log.debug('Found AC Unit address in configuration:', ip);
328
+ const addrParts = ip.split('.');
329
+ const addresses = {};
330
+ Object.keys(pluginAddresses).forEach((addr) => {
331
+ const netmaskParts = pluginAddresses[addr].split('.');
332
+ const broadcast = addrParts.map((e, i) => ((~Number(netmaskParts[i]) & 0xFF) | Number(e)).toString()).join('.');
333
+ if (addr === broadcast) {
334
+ addresses[ip] = true;
335
+ }
336
+ });
337
+ const skipAddress = Object.keys(addresses).find((addr) => addr === ip);
338
+ if (skipAddress === undefined) {
339
+ pluginAddresses[ip] = '255.255.255.255';
340
+ }
341
+ else {
342
+ this.log.debug('AC Unit (%s) is already on broadcast list - skipping', skipAddress);
343
+ }
344
+ }
345
+ else {
346
+ this.log.warn('Warning: Invalid IP address found in configuration: %s - skipping', ip);
347
+ }
348
+ });
349
+ }
350
+ return pluginAddresses;
351
+ }
256
352
  }
257
353
  exports.GreeACPlatform = GreeACPlatform;
258
354
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
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M,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;wBAC5C,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;wBACtD,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAChH,IAAI,IAAI,KAAK,SAAS,EAAE;4BACtB,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;yBACtB;oBACH,CAAC,CAAC,CAAC;oBACH,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;oBACvE,IAAI,WAAW,KAAK,SAAS,EAAE;wBAC7B,eAAe,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC;qBACzC;yBAAM;wBACL,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,sDAAsD,EAAE,WAAW,CAAC,CAAC;qBACrF;iBACF;qBAAM;oBACL,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mEAAmE,EAAE,EAAE,CAAC,CAAC;iBACxF;YACH,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAjWD,wCAiWC"}
@@ -21,7 +21,7 @@ export declare class GreeAirConditioner {
21
21
  private bound;
22
22
  private status;
23
23
  private updateTimer;
24
- constructor(platform: GreeACPlatform, accessory: PlatformAccessory, deviceConfig: DeviceConfig, port: number, platform_ts: GreeAirConditionerTS);
24
+ constructor(platform: GreeACPlatform, accessory: PlatformAccessory, deviceConfig: DeviceConfig, port: number, platform_ts: GreeAirConditionerTS | null);
25
25
  /**
26
26
  * Handle "SET" requests from HomeKit
27
27
  * These are sent when the user changes the state of an accessory
@@ -1 +1 @@
1
- {"version":3,"file":"platformAccessory.d.ts","sourceRoot":"","sources":["../src/platformAccessory.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAyE,MAAM,YAAY,CAAC;AACjH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,kBAAkB;IAW3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAd9B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,GAAG,CAAqB;IAChC,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAA6B;gBAG7B,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,iBAAiB,EAC5B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,oBAAoB;IAkHpD;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,mBAAmB;IAMpC,0BAA0B,CAAC,KAAK,EAAE,mBAAmB;IAiBrD,oBAAoB,CAAC,KAAK,EAAE,mBAAmB;IAK/C,0BAA0B,CAAC,KAAK,EAAE,mBAAmB;I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AErB;IAED,IAAI,iBAAiB,WAoBpB;IAED,IAAI,iBAAiB,CAAC,KAAK,QAAA,EAwB1B;IAED,IAAI,KAAK,QAER;IAED,IAAI,KAAK,CAAC,KAAK,KAAA,EAOd;IAED,IAAI,SAAS,QAEZ;IAED,IAAI,SAAS,CAAC,KAAK,KAAA,EAOlB;IAED,IAAI,KAAK,QAER;IAED,IAAI,KAAK,CAAC,KAAK,KAAA,EAWd;IAED,IAAI,SAAS,QAEZ;IAED,IAAI,SAAS,CAAC,KAAK,KAAA,EAiBlB;IAED,IAAI,YAAY,QAEf;IAED,IAAI,YAAY,CAAC,KAAK,KAAA,EAiBrB;IAED,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE;IAkL5B,aAAa,iCAoFX;IAEF,WAAW,CAAC,OAAO,KAAA;IA6CnB,eAAe;IAUf,WAAW,CAAC,GAAG,KAAA;IAYf,mBAAmB;CAQpB"}
@@ -15,7 +15,7 @@ const commands_1 = __importDefault(require("./commands"));
15
15
  */
16
16
  class GreeAirConditioner {
17
17
  constructor(platform, accessory, deviceConfig, port, platform_ts) {
18
- var _a, _b, _c;
18
+ var _a, _b, _c, _d;
19
19
  this.platform = platform;
20
20
  this.accessory = accessory;
21
21
  this.deviceConfig = deviceConfig;
@@ -23,6 +23,7 @@ class GreeAirConditioner {
23
23
  this.platform_ts = platform_ts;
24
24
  // device communication functions
25
25
  this.handleMessage = (msg, rinfo) => {
26
+ var _a;
26
27
  if (this.accessory.context.device.address === rinfo.address) {
27
28
  this.platform.log.debug(`[${this.getDeviceLabel()}] handleMessage -> %s`, msg.toString());
28
29
  this.platform.log.debug(`[${this.getDeviceLabel()}] handleMessage -> Encryption version: %i`, this.accessory.context.device.encryptionVersion);
@@ -51,6 +52,7 @@ class GreeAirConditioner {
51
52
  this.key = pack.key;
52
53
  this.bound = true;
53
54
  this.accessory.context.bound = true;
55
+ (_a = this.platform_ts) === null || _a === void 0 ? void 0 : _a.setBound(true);
54
56
  this.platform.log.info(`[${this.getDeviceLabel()}] Device is bound -> ${pack.mac}`);
55
57
  this.platform.log.debug(`[${this.getDeviceLabel()}] Device key -> ${this.key}`);
56
58
  if (this.updateTimer) {
@@ -87,7 +89,10 @@ class GreeAirConditioner {
87
89
  pack.opt.forEach((opt, i) => {
88
90
  const value = pack.p !== undefined ? pack.p[i] : pack.val[i];
89
91
  if (this.status[opt] !== value) {
90
- updatedParams.push(`${this.getKeyName(commands_1.default, opt, 'code')}: ${this.status[opt]} -> ${value}`);
92
+ const cmd = this.getKeyName(commands_1.default, opt, 'code');
93
+ const oldval = this.getKeyName(commands_1.default[cmd].value, this.status[opt]) || this.status[opt];
94
+ const newval = this.getKeyName(commands_1.default[cmd].value, value) || value;
95
+ updatedParams.push(`${cmd}: ${oldval} -> ${newval}`);
91
96
  }
92
97
  this.status[opt] = value;
93
98
  });
@@ -104,23 +109,25 @@ class GreeAirConditioner {
104
109
  }
105
110
  };
106
111
  this.accessory.context.bound = false;
112
+ (_a = this.platform_ts) === null || _a === void 0 ? void 0 : _a.setBound(false);
107
113
  this.platform.log.debug(`[${this.getDeviceLabel()}] deviceConfig -> %j`, deviceConfig);
108
114
  // set accessory information
109
115
  this.accessory.getService(this.platform.Service.AccessoryInformation)
110
116
  .setCharacteristic(this.platform.Characteristic.Manufacturer, this.accessory.context.device.brand || 'Gree')
111
- .setCharacteristic(this.platform.Characteristic.Model, ((_a = this.deviceConfig) === null || _a === void 0 ? void 0 : _a.model) || this.accessory.context.device.model || this.accessory.context.device.name || 'Air Conditioner')
117
+ .setCharacteristic(this.platform.Characteristic.Model, ((_b = this.deviceConfig) === null || _b === void 0 ? void 0 : _b.model) || this.accessory.context.device.model || this.accessory.context.device.name || 'Air Conditioner')
112
118
  .setCharacteristic(this.platform.Characteristic.SerialNumber, this.accessory.context.device.mac)
113
119
  .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.accessory.context.device.hid && this.accessory.context.device.hid.lastIndexOf('V') >= 0 &&
114
120
  this.accessory.context.device.hid.lastIndexOf('V') < this.accessory.context.device.hid.lastIndexOf('.') ?
115
121
  this.accessory.context.device.hid.substring(this.accessory.context.device.hid.lastIndexOf('V') + 1, this.accessory.context.device.hid.lastIndexOf('.')) : '1.0.0')
116
122
  .setCharacteristic(this.platform.Characteristic.HardwareRevision, this.accessory.context.device.ver ?
117
- this.accessory.context.device.ver.substring(this.accessory.context.device.ver.lastIndexOf('V') + 1) : '1.0.0');
123
+ this.accessory.context.device.ver.substring(this.accessory.context.device.ver.lastIndexOf('V') + 1) : '1.0.0')
124
+ .setCharacteristic(this.platform.Characteristic.Name, this.accessory.displayName);
118
125
  // get the HeaterCooler service if it exists, otherwise create a new HeaterCooler service
119
126
  // we don't use subtype because we add only one service with this type
120
127
  this.HeaterCooler = this.accessory.getService(this.platform.Service.HeaterCooler) ||
121
128
  this.accessory.addService(this.platform.Service.HeaterCooler, this.accessory.displayName, undefined);
122
129
  this.HeaterCooler.displayName = this.accessory.displayName;
123
- if (deviceConfig.temperatureSensor === 'child') {
130
+ if (deviceConfig.temperatureSensor === settings_1.TS_TYPE.child) {
124
131
  this.platform.log.debug(`[${this.getDeviceLabel()}] Add Temperature Sensor child service`);
125
132
  this.TemperatureSensor = this.accessory.getService(this.platform.Service.TemperatureSensor) ||
126
133
  this.accessory.addService(this.platform.Service.TemperatureSensor, 'Temperature Sensor - ' + this.accessory.displayName, undefined);
@@ -135,7 +142,7 @@ class GreeAirConditioner {
135
142
  }
136
143
  }
137
144
  this.HeaterCooler.setPrimaryService(true);
138
- (_b = this.TemperatureSensor) === null || _b === void 0 ? void 0 : _b.setPrimaryService(false);
145
+ (_c = this.TemperatureSensor) === null || _c === void 0 ? void 0 : _c.setPrimaryService(false);
139
146
  // each service must implement at-minimum the "required characteristics" for the given service type
140
147
  // see https://developers.homebridge.io/#/service/HeaterCooler
141
148
  // register handlers for the Active Characteristic
@@ -152,7 +159,7 @@ class GreeAirConditioner {
152
159
  // register handlers for the Current Temperature Characteristic
153
160
  this.HeaterCooler.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
154
161
  .onGet(this.getCurrentTemperature.bind(this, 'Heater Cooler'));
155
- (_c = this.TemperatureSensor) === null || _c === void 0 ? void 0 : _c.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getCurrentTemperature.bind(this, 'Temperature Sensor'));
162
+ (_d = this.TemperatureSensor) === null || _d === void 0 ? void 0 : _d.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getCurrentTemperature.bind(this, 'Temperature Sensor'));
156
163
  // register handlers for the Cooling Threshold Temperature Characteristic
157
164
  // (minValue and maxValue can't be set here, they need an active accessory in cooling sate to set)
158
165
  this.HeaterCooler.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
@@ -190,7 +197,11 @@ class GreeAirConditioner {
190
197
  this.platform.log.error(`[${this.getDeviceLabel()}] Network - Error:`, err.message);
191
198
  });
192
199
  this.socket.on('message', this.handleMessage);
193
- this.socket.bind(this.port + parseInt(this.accessory.context.device.address.split('.')[3]) + 1, '0.0.0.0', () => {
200
+ this.socket.on('close', () => {
201
+ this.platform.log.error(`[${this.getDeviceLabel()}] Network - Connection closed`);
202
+ });
203
+ this.socket.bind(this.deviceConfig.port, undefined, () => {
204
+ this.platform.log.info(`[${this.getDeviceLabel()}] Device handler is listening on UDP port %d`, this.socket.address().port);
194
205
  this.socket.setBroadcast(false);
195
206
  this.sendBindRequest();
196
207
  });
@@ -455,6 +466,7 @@ class GreeAirConditioner {
455
466
  }
456
467
  break;
457
468
  }
469
+ this.platform.api.updatePlatformAccessories([this.accessory]);
458
470
  }
459
471
  getDeviceLabel() {
460
472
  return `${this.accessory.displayName} -- ${this.accessory.context.device.address}:${this.accessory.context.device.port}`;
@@ -467,24 +479,26 @@ class GreeAirConditioner {
467
479
  }
468
480
  getKeyName(obj, value, subkey) {
469
481
  let name = '';
470
- if (subkey === undefined) {
471
- Object.entries(obj).find(([key, val]) => {
472
- if (val === value) {
473
- name = key;
474
- return true;
475
- }
476
- return false;
477
- });
478
- }
479
- else {
480
- Object.entries(obj).find(([key, val]) => {
481
- const v = val;
482
- if (v[subkey] === value) {
483
- name = key;
484
- return true;
485
- }
486
- return false;
487
- });
482
+ if (obj !== undefined) {
483
+ if (subkey === undefined) {
484
+ Object.entries(obj).find(([key, val]) => {
485
+ if (val === value) {
486
+ name = key;
487
+ return true;
488
+ }
489
+ return false;
490
+ });
491
+ }
492
+ else {
493
+ Object.entries(obj).find(([key, val]) => {
494
+ const v = val;
495
+ if (v[subkey] === value) {
496
+ name = key;
497
+ return true;
498
+ }
499
+ return false;
500
+ });
501
+ }
488
502
  }
489
503
  return name;
490
504
  }