homebridge-gree-ac 2.1.0 → 2.1.2

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,12 +24,20 @@ 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 {
28
- const message = JSON.parse(msg.toString());
31
+ let message;
32
+ try {
33
+ message = JSON.parse(msg.toString());
34
+ }
35
+ catch (e) {
36
+ this.log.debug('handleMessage - unknown message from %s - BASE64 encoded message: %s', rinfo.address.toString(), Buffer.from(msg).toString('base64'));
37
+ return;
38
+ }
29
39
  if (message.i !== 1 || message.t !== 'pack') {
30
- this.log.debug('handleMessage - unknown response: %j', message);
40
+ this.log.debug('handleMessage - unknown response from %s: %j', rinfo.address.toString(), message);
31
41
  return;
32
42
  }
33
43
  let pack, encryptionVersion;
@@ -55,23 +65,24 @@ class GreeACPlatform {
55
65
  });
56
66
  }
57
67
  else {
58
- this.log.debug('handleMessage - unknown package: %j', pack);
68
+ this.log.debug('handleMessage - unknown package from %s: %j', rinfo.address.toString(), pack);
59
69
  }
60
70
  }
61
71
  catch (err) {
62
72
  const msg = err.message;
63
- this.log.error('handleMessage - Error:', msg);
73
+ this.log.error('handleMessage (%s) - Error: %s', rinfo.address.toString(), msg);
64
74
  }
65
75
  };
66
76
  this.registerDevice = (deviceInfo) => {
67
77
  var _a, _b;
78
+ this.log.debug('registerDevice - deviceInfo:', JSON.stringify(deviceInfo));
68
79
  const devcfg = this.config.devices.find((item) => item.mac === deviceInfo.mac) || {};
69
80
  const deviceConfig = {
70
81
  ...devcfg,
71
82
  ...((devcfg.speedSteps && devcfg.speedSteps !== 3 && devcfg.speedSteps !== 5) || devcfg.speedSteps === 0 ?
72
83
  { speedSteps: 5 } : {}),
73
- ...((devcfg.temperatureSensor && ['disabled', 'child', 'separate'].includes(devcfg.temperatureSensor.toLowerCase())) ?
74
- { 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 }),
75
86
  ...(devcfg.minimumTargetTemperature && (devcfg.minimumTargetTemperature < settings_1.DEFAULT_DEVICE_CONFIG.minimumTargetTemperature ||
76
87
  devcfg.minimumTargetTemperature > settings_1.DEFAULT_DEVICE_CONFIG.maximumTargetTemperature) ?
77
88
  { minimumTargetTemperature: settings_1.DEFAULT_DEVICE_CONFIG.minimumTargetTemperature } : {}),
@@ -101,76 +112,125 @@ class GreeACPlatform {
101
112
  let accessory_ts = this.devices[deviceInfo.mac + '_ts'];
102
113
  if ((deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.disabled) || !/^[a-f0-9]{12}$/.test(deviceConfig.mac)) {
103
114
  if (!this.skippedDevices[deviceInfo.mac]) {
104
- this.log.info(`Accessory ${deviceInfo.mac} skipped`);
115
+ this.log.info(`Accessory ${deviceInfo.mac}${devcfg.mac === undefined ? ' not configured -' : ''} skipped`);
105
116
  this.skippedDevices[deviceInfo.mac] = true;
106
117
  }
118
+ else {
119
+ this.log.debug(`Accessory ${deviceInfo.mac}${devcfg.mac === undefined ? ' not configured -' : ''} skipped`);
120
+ }
107
121
  if (accessory) {
122
+ delete this.devices[accessory.context.deviceInfo.mac];
108
123
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
109
- delete this.devices[deviceConfig.mac];
124
+ this.log.debug(`registerDevice - unregister (${devcfg.mac === undefined ? 'not configured' : 'disabled'}):`, accessory.displayName, accessory.UUID);
125
+ accessory = undefined;
110
126
  }
111
127
  if (accessory_ts) {
128
+ delete this.devices[accessory_ts.context.deviceInfo.mac];
112
129
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
113
- delete this.devices[deviceConfig.mac + '_ts'];
130
+ this.log.debug(`registerDevice - unregister (${devcfg.mac === undefined ? 'not configured' : 'disabled'}):`, accessory_ts.displayName, accessory_ts.UUID);
131
+ accessory_ts = undefined;
114
132
  }
115
133
  return;
116
134
  }
135
+ // check device address change
136
+ if (accessory && deviceInfo.address !== accessory.context.device.address) {
137
+ this.log.info(`Device [${accessory.displayName} - ${accessory.context.device.mac}] address has changed: %s -> %s`, accessory.context.device.address, deviceInfo.address);
138
+ accessory.context.device.address = deviceInfo.address;
139
+ }
140
+ if (accessory_ts && deviceInfo.address !== accessory_ts.context.device.address) {
141
+ accessory_ts.context.device.address = deviceInfo.address;
142
+ }
117
143
  if (accessory && this.initializedDevices[accessory.UUID]) {
118
144
  // already initalized
145
+ this.log.debug('registerDevice - already initalized:', accessory.displayName, accessory.UUID, accessory.context.device.mac);
119
146
  return;
120
147
  }
148
+ // register heatercooler accessory
149
+ const deviceName = (_a = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _a !== void 0 ? _a : (deviceInfo.name || deviceInfo.mac);
121
150
  if (!accessory) {
122
- const deviceName = (_a = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _a !== void 0 ? _a : (deviceInfo.name || deviceInfo.mac);
123
- this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName}...`);
151
+ this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName} ...`);
124
152
  const uuid = this.api.hap.uuid.generate(deviceInfo.mac);
125
153
  accessory = new this.api.platformAccessory(deviceName, uuid, 21 /* Categories.AIR_CONDITIONER */);
126
154
  this.devices[deviceInfo.mac] = accessory;
127
155
  this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
128
156
  }
129
- if (!accessory_ts && deviceConfig.temperatureSensor === 'separate') {
130
- const deviceName_ts = 'Temperature Sensor - ' + ((_b = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _b !== void 0 ? _b : (deviceInfo.name || deviceInfo.mac));
131
- this.log.debug(`Initializing new accessory ${deviceInfo.mac} with name ${deviceName_ts}...`);
157
+ // register temperaturesensor accessory if configured as separate
158
+ const tsDeviceName = 'Temperature Sensor - ' + ((_b = deviceConfig === null || deviceConfig === void 0 ? void 0 : deviceConfig.name) !== null && _b !== void 0 ? _b : (deviceInfo.name || deviceInfo.mac));
159
+ if (!accessory_ts && deviceConfig.temperatureSensor === settings_1.TS_TYPE.separate) {
160
+ this.log.debug(`Initializing new accessory ${deviceInfo.mac}_ts with name ${tsDeviceName} ...`);
132
161
  const uuid = this.api.hap.uuid.generate(deviceInfo.mac + '_ts');
133
- accessory_ts = new this.api.platformAccessory(deviceName_ts, uuid, 10 /* Categories.SENSOR */);
162
+ accessory_ts = new this.api.platformAccessory(tsDeviceName, uuid, 10 /* Categories.SENSOR */);
134
163
  this.devices[deviceInfo.mac + '_ts'] = accessory_ts;
135
164
  this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
136
165
  }
137
- if (accessory_ts && deviceConfig.temperatureSensor !== 'separate') {
166
+ // unregister temperaturesensor accessory if configuration has changed from separate to any other
167
+ if (accessory_ts && deviceConfig.temperatureSensor !== settings_1.TS_TYPE.separate) {
138
168
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory_ts]);
139
- delete this.devices[deviceConfig.mac + '_ts'];
169
+ delete this.devices[deviceInfo.mac + '_ts'];
170
+ this.log.debug('registerDevice - unregister:', accessory_ts.displayName, accessory_ts.UUID);
171
+ accessory_ts = undefined;
140
172
  }
141
- let tsService;
142
- if (accessory_ts && deviceConfig.temperatureSensor === 'separate') {
143
- // mark temperature sensor devices as initialized
144
- accessory_ts.context.device = deviceInfo;
173
+ let tsService = null;
174
+ if (accessory_ts && deviceConfig.temperatureSensor === settings_1.TS_TYPE.separate) {
175
+ // mark temperature sensor device as initialized
176
+ accessory_ts.context.device = { ...deviceInfo };
177
+ accessory_ts.context.device.mac = deviceInfo.mac + '_ts';
145
178
  accessory_ts.context.deviceType = 'TemperatureSensor';
179
+ accessory_ts.displayName = tsDeviceName;
146
180
  this.initializedDevices[accessory_ts.UUID] = true;
147
181
  tsService = new tsAccessory_1.GreeAirConditionerTS(this, accessory_ts, deviceConfig);
182
+ this.log.debug(`registerDevice - ${accessory_ts.context.deviceType} initialized:`, accessory_ts.displayName, accessory_ts.context.device.mac, accessory_ts.UUID);
148
183
  }
149
184
  if (accessory) {
150
- // mark devices as initialized
185
+ // mark heatercooler device as initialized
151
186
  accessory.context.device = deviceInfo;
152
187
  accessory.context.deviceType = 'HeaterCooler';
153
- accessory.context.accessory_ts = accessory_ts;
154
- accessory.context.bound = false;
188
+ accessory.displayName = deviceName;
155
189
  this.initializedDevices[accessory.UUID] = true;
156
- return new platformAccessory_1.GreeAirConditioner(this, accessory, deviceConfig, this.config.port, tsService);
190
+ this.log.debug(`registerDevice - ${accessory.context.deviceType} initialized:`, accessory.displayName, accessory.context.device.mac, accessory.UUID);
191
+ new platformAccessory_1.GreeAirConditioner(this, accessory, deviceConfig, this.config.port, tsService);
192
+ }
193
+ // update registered accessories at the end of initialization
194
+ const accessories = [accessory];
195
+ if (accessory_ts) {
196
+ accessories.push(accessory_ts);
157
197
  }
198
+ this.api.updatePlatformAccessories(accessories);
158
199
  };
159
- this.socket = dgram_1.default.createSocket({ type: 'udp4', reuseAddr: true });
160
200
  this.devices = {};
161
201
  this.initializedDevices = {};
162
202
  this.skippedDevices = {};
163
- this.scanCount = 0;
164
- this.log.debug('Finished initializing platform:', this.config.name);
203
+ this.pluginAddresses = this.getNetworkAddresses();
204
+ if (Object.entries(this.pluginAddresses).length > 0) {
205
+ this.log.debug('Homebridge host addresses: ', this.pluginAddresses);
206
+ }
207
+ else {
208
+ this.log.error('Error: Homebridge host has no IPv4 address');
209
+ }
210
+ // if no IPv4 address found we create socket for IPv6
211
+ this.socket = dgram_1.default.createSocket({ type: (Object.entries(this.pluginAddresses).length > 0) ? 'udp4' : 'udp6', reuseAddr: true });
212
+ this.socket.on('error', (err) => {
213
+ this.log.error('Network - Error:', err.message);
214
+ });
215
+ this.socket.on('close', () => {
216
+ this.log.debug('Network - Connection closed');
217
+ });
218
+ this.log.debug('Finished initializing platform');
165
219
  // When this event is fired it means Homebridge has restored all cached accessories from disk.
166
220
  // Dynamic Platform plugins should only register new accessories after this event was fired,
167
221
  // in order to ensure they weren't added to homebridge already. This event can also be used
168
222
  // to start discovery of new accessories.
169
223
  this.api.on('didFinishLaunching', () => {
170
224
  log.debug('Executed didFinishLaunching callback');
171
- this.socket.on('message', this.handleMessage);
172
- // run the method to discover / register your devices as accessories
173
- this.discoverDevices();
225
+ if (Object.entries(this.pluginAddresses).length === 0) {
226
+ this.socket.close();
227
+ this.log.error('Network - Error: No IPv4 host address found');
228
+ }
229
+ else {
230
+ this.socket.on('message', this.handleMessage);
231
+ // run the method to discover / register your devices as accessories
232
+ this.discoverDevices();
233
+ }
174
234
  });
175
235
  }
176
236
  /**
@@ -179,73 +239,80 @@ class GreeACPlatform {
179
239
  */
180
240
  configureAccessory(accessory) {
181
241
  var _a;
182
- this.log.debug('Loading accessory from cache: ', accessory.displayName, accessory.context.device);
242
+ this.log.debug('Loading accessory from cache:', accessory.displayName, JSON.stringify(accessory.context.device));
183
243
  // add the restored accessory to the accessories cache so we can track if it has already been registered
184
244
  if ((_a = accessory.context.device) === null || _a === void 0 ? void 0 : _a.mac) {
185
- if (accessory.context.deviceType === undefined || accessory.context.deviceType === 'HeaterCooler') {
186
- // this is the main accessory
187
- this.devices[accessory.context.device.mac] = accessory;
188
- }
189
- if (accessory.context.deviceType === 'TemperatureSensor') {
190
- // this is the temperature sensor
191
- this.devices[accessory.context.device.mac + '_ts'] = accessory;
192
- }
245
+ accessory.context.bound = false;
246
+ this.devices[accessory.context.device.mac] = accessory;
247
+ }
248
+ // clean all invalid accessories found in cache
249
+ if (!accessory.context) {
250
+ this.log.debug('Invalid accessory found in cache - deleting:', accessory.displayName, accessory.UUID);
251
+ this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
193
252
  }
194
253
  }
195
254
  /**
196
255
  * Accessories must only be registered once, previously created accessories
197
256
  * must not be registered again to prevent "duplicate UUID" errors.
198
257
  */
258
+ bindCallback() {
259
+ 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);
260
+ this.socket.setBroadcast(true);
261
+ setInterval(() => {
262
+ this.broadcastScan();
263
+ }, (this.config.scanInterval || settings_1.DEF_SCAN_INTERVAL) * 1000); // scanInterval in seconds (default = 60 sec)
264
+ }
199
265
  discoverDevices() {
200
- if (this.config.port !== undefined && typeof this.config.port === 'number' && this.config.port === this.config.port &&
201
- this.config.port >= 0 && this.config.port <= 65279) {
202
- this.socket.bind(this.config.port, () => {
203
- this.log.info(`UDP server bind to port ${this.config.port}`);
204
- this.socket.setBroadcast(true);
205
- this.timer = setInterval(() => {
206
- this.scanCount += 1;
207
- if (this.scanCount > this.config.scanCount && this.timer) {
208
- this.log.info('Scan finished.');
209
- clearInterval(this.timer);
210
- this.socket.close();
211
- // remove accessories not found on network or not responsing to bind request
212
- Object.entries(this.devices).forEach(([key, value]) => {
213
- if (value && !value.context.bound && this.initializedDevices[value.UUID] &&
214
- (value.context.deviceType === 'HeaterCooler' || value.context.deviceType === undefined)) {
215
- 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);
216
- if (value.context.accessory_ts) {
217
- this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [value.context.accessory_ts]);
218
- delete this.initializedDevices[value.context.accessory_ts.UUID];
219
- delete this.devices[value.context.accessory_ts.context.device.mac + '_ts'];
220
- }
221
- this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [value]);
222
- delete this.initializedDevices[value.UUID];
223
- }
224
- if (value && !this.initializedDevices[value.UUID]) {
225
- this.log.debug('Cleanup -> Remove', value.displayName, key, value.UUID);
226
- delete this.devices[key];
227
- }
228
- });
229
- }
230
- else {
231
- this.broadcastScan();
232
- }
233
- }, this.config.scanTimeout * 1000); // scanTimeout in seconds
234
- });
266
+ if (this.config.port === undefined || (this.config.port !== undefined && typeof this.config.port === 'number' &&
267
+ this.config.port === this.config.port && this.config.port >= 0 && this.config.port <= 65279)) {
268
+ this.socket.bind(this.config.port, undefined, () => this.bindCallback());
235
269
  }
236
270
  else {
237
- this.log.warn('Warning: Port is missing or misconfigured (Valid port values: 1025~65279)');
271
+ this.log.error('Error: Port is misconfigured (Valid port values: 1025~65279 or leave port empty to auto select)');
272
+ this.socket.close();
238
273
  }
239
274
  }
240
275
  broadcastScan() {
241
276
  const message = Buffer.from(JSON.stringify({ t: 'scan' }));
242
- this.socket.send(message, 0, message.length, settings_1.UDP_SCAN_PORT, this.config.scanAddress, (error) => {
243
- this.log.debug(`Broadcast '${message}' ${this.config.scanAddress}:${settings_1.UDP_SCAN_PORT}`);
244
- if (error) {
245
- this.log.error('broadcastScan - Error:', error.message);
246
- }
277
+ Object.entries(this.pluginAddresses).forEach((value) => {
278
+ this.socket.send(message, 0, message.length, settings_1.UDP_SCAN_PORT, value[0], (error) => {
279
+ this.log.debug(`Broadcast '${message}' ${value[0]}:${settings_1.UDP_SCAN_PORT}`);
280
+ if (error) {
281
+ this.log.error('broadcastScan - Error:', error.message);
282
+ }
283
+ });
247
284
  });
248
285
  }
286
+ getNetworkAddresses() {
287
+ this.log.debug('Checking network interfaces');
288
+ const pluginAddresses = {};
289
+ const allInterfaces = (0, os_1.networkInterfaces)();
290
+ for (const name of Object.keys(allInterfaces)) {
291
+ const nets = allInterfaces[name];
292
+ if (nets) {
293
+ for (const iface of nets) {
294
+ // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
295
+ const familyV4Value = typeof iface.family === 'string' ? 'IPv4' : 4;
296
+ if (iface.family === familyV4Value && !iface.internal) {
297
+ const addrParts = iface.address.split('.');
298
+ const netmaskParts = iface.netmask.split('.');
299
+ const broadcast = addrParts.map((e, i) => ((~Number(netmaskParts[i]) & 0xFF) | Number(e)).toString()).join('.');
300
+ this.log.debug('Interface: \'%s\' Address: %s Netmask: %s Broadcast: %s', name, iface.address, iface.netmask, broadcast);
301
+ pluginAddresses[broadcast] = pluginAddresses[broadcast] === undefined ? iface.address :
302
+ pluginAddresses[broadcast] + ';' + iface.address;
303
+ }
304
+ }
305
+ }
306
+ }
307
+ // Sort IP addresses for consistent comparison
308
+ for (const bcast of Object.keys(pluginAddresses)) {
309
+ // Keep only unique IPs
310
+ const ips = Array.from(new Set(pluginAddresses[bcast].split(';')));
311
+ ips.sort((a, b) => (a < b ? -1 : 1));
312
+ pluginAddresses[bcast] = ips.join(';');
313
+ }
314
+ return pluginAddresses;
315
+ }
249
316
  }
250
317
  exports.GreeACPlatform = GreeACPlatform;
251
318
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","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EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,eAAe,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACxC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAhUD,wCAgUC"}
@@ -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;I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AM;IAgCnD,cAAc;IAId,OAAO;IAOP,UAAU,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,MAAM,CAAC,KAAA,GAAG,MAAM;IAyBvC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAS1C,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAY5C,uBAAuB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,GAAG,MAAM;IAoB7C,IAAI,KAAK,YAER;IAED,IAAI,KAAK,CAAC,KAAK,SAAA,EA0Cd;IAED,IAAI,IAAI,QAEP;IAED,IAAI,IAAI,CAAC,KAAK,KAAA,EAoBb;IAED,IAAI,kBAAkB,WAErB;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.port !== undefined ? (this.port + parseInt(this.accessory.context.device.address.split('.')[3]) + 1) : undefined, undefined, () => {
204
+ this.platform.log.debug(`[${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
  }