homebridge-nest-accfactory 0.0.4-a → 0.0.6

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/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ All notable changes to `homebridge-nest-accfactory` will be documented in this f
6
6
 
7
7
  Currently all releases are considered 'alpha' status, where things may or may not be working. Use at your own risk :-)
8
8
 
9
+ ## v0.0.6 (2024-09-14)
10
+
11
+ - Fix for two/way audio starting on non-enabled HKSV camera/doorbells
12
+
13
+ ## v0.0.5 (2024-09-13)
14
+
15
+ - General code cleanup and bug fixes
16
+ - External dependancy reductions, dropped pbf and axios libraries
17
+ - Nest Cam with Floodlight support with light on/off and brightness control
18
+ - Fixed issued with setting range temperatures on Nest Thermostat(s)
19
+
9
20
  ## v0.0.4 (2024-09-07)
10
21
 
11
22
  - Camera/Doorbell support for snapshots and live video re-introduced
@@ -19,7 +30,7 @@ Currently all releases are considered 'alpha' status, where things may or may no
19
30
  - Cleanup fix for when removing a camera/doorbell from Nest/Google
20
31
  - Fix for virtual weather device when missing configured city and/or state details
21
32
  - Fix for retrieving data from Nest systems when using both a Nest and Google accounts
22
- - Initial support newer Nest/Google camera/doorbell devices (streaming/recording - coming)
33
+ - Initial support for newer Nest/Google camera/doorbell devices (streaming/recording - coming)
23
34
 
24
35
  ## v0.0.1 (2024-08-27)
25
36
 
package/README.md CHANGED
@@ -15,13 +15,13 @@ Formally known as [Nest_accfactory](https://github.com/n0rt0nthec4t/Nest_accfact
15
15
 
16
16
  ## Supported Devices
17
17
 
18
- The following Nest devices are supported
18
+ The following Nest devices are known to be supported
19
19
 
20
- * Nest Thermostats (Gen 1, Gen 2, Gen 3, E, 2020, Gen 4)
21
- * Nest Protects (Gen 1, Gen 2)
22
- * Nest Temp Sensors (Gen 1)
23
- * Nest Cameras (Cam Indoor, IQ Indoor, Outdoor, IQ Outdoor)
24
- * Nest Doorbells (Gen 1)
20
+ * Nest Thermostats (1st gen, 2nd gen, 3rd gen, E, 2020 mirror edition, 4th gen)
21
+ * Nest Protects (1st and 2nd gen)
22
+ * Nest Temp Sensors (1st gen)
23
+ * Nest Cameras (Cam Indoor, IQ Indoor, Outdoor, IQ Outdoor, Cam with Floodlight)
24
+ * Nest Doorbells (wired 1st gen)
25
25
 
26
26
  The accessory supports connection to Nest using a Nest account OR a Google (migrated Nest account) account.
27
27
 
@@ -118,4 +118,4 @@ The following options are available on a per-device level in the config.json dev
118
118
 
119
119
  ## Caveats
120
120
 
121
- Nest_accfactory is a hobby project of mine, provided as-is, with no warranty whatsoever. I've been running it successfully at my home, but your mileage might vary.
121
+ homebridge-nest-accfactory and Nest_accfactory are both hobby projects of mine, provided as-is, with no warranty whatsoever. I've been running it successfully at my home, but your mileage might vary. If you do find an issue, please reachout and see what we can do
@@ -37,7 +37,7 @@
37
37
  // HomeKitDevice.updateServices(deviceData)
38
38
  // HomeKitDevice.messageServices(type, message)
39
39
  //
40
- // Code version 6/9/2024
40
+ // Code version 13/9/2024
41
41
  // Mark Hulskamp
42
42
  'use strict';
43
43
 
@@ -104,7 +104,8 @@ export default class HomeKitDevice {
104
104
  this.#eventEmitter.addListener(this.deviceData.uuid, this.#message.bind(this));
105
105
  }
106
106
 
107
- // Make copy of current data and store in this object
107
+ // Make a clone of current data and store in this object
108
+ // Important that we done have a 'linked' cope of the object data
108
109
  // eslint-disable-next-line no-undef
109
110
  this.deviceData = structuredClone(deviceData);
110
111
 
@@ -149,7 +150,10 @@ export default class HomeKitDevice {
149
150
  this.deviceData.model === '' ||
150
151
  typeof this.deviceData?.manufacturer !== 'string' ||
151
152
  this.deviceData.manufacturer === '' ||
152
- (this.#platform === undefined && typeof this.deviceData?.hkPairingCode !== 'string' && this.deviceData.hkPairingCode === '') ||
153
+ (this.#platform === undefined &&
154
+ typeof this.deviceData?.hkPairingCode !== 'string' &&
155
+ (new RegExp(/^([0-9]{3}-[0-9]{2}-[0-9]{3})$/).test(this.deviceData.hkPairingCode) === true ||
156
+ new RegExp(/^([0-9]{4}-[0-9]{4})$/).test(this.deviceData.hkPairingCode) === true)) ||
153
157
  (this.#platform === undefined &&
154
158
  typeof this.deviceData?.hkUsername !== 'string' &&
155
159
  new RegExp(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/).test(this.deviceData.hkUsername) === false)
@@ -239,7 +243,7 @@ export default class HomeKitDevice {
239
243
  }
240
244
  }
241
245
 
242
- async remove() {
246
+ remove() {
243
247
  this?.log?.warn && this.log.warn('Device "%s" has been removed', this.deviceData.description);
244
248
 
245
249
  if (this.#eventEmitter === undefined && typeof this.deviceData?.uuid === 'string' && this.deviceData.uuid !== '') {
@@ -249,7 +253,7 @@ export default class HomeKitDevice {
249
253
 
250
254
  if (typeof this.removeServices === 'function') {
251
255
  try {
252
- await this.removeServices();
256
+ this.removeServices();
253
257
  } catch (error) {
254
258
  this?.log?.error && this.log.error('removeServices call for device "%s" failed. Error was', this.deviceData.description, error);
255
259
  }
@@ -278,7 +282,7 @@ export default class HomeKitDevice {
278
282
  // delete this;
279
283
  }
280
284
 
281
- async update(deviceData, forceUpdate) {
285
+ update(deviceData, forceUpdate) {
282
286
  if (typeof deviceData !== 'object' || typeof forceUpdate !== 'boolean') {
283
287
  return;
284
288
  }
@@ -357,7 +361,7 @@ export default class HomeKitDevice {
357
361
 
358
362
  if (typeof this.updateServices === 'function') {
359
363
  try {
360
- await this.updateServices(deviceData); // Pass updated data on for accessory to process as it needs
364
+ this.updateServices(deviceData); // Pass updated data on for accessory to process as it needs
361
365
  } catch (error) {
362
366
  this?.log?.error && this.log.error('updateServices call for device "%s" failed. Error was', this.deviceData.description, error);
363
367
  }
@@ -381,6 +385,13 @@ export default class HomeKitDevice {
381
385
 
382
386
  // Send event with data to set
383
387
  this.#eventEmitter.emit(HomeKitDevice.SET, this.deviceData.uuid, values);
388
+
389
+ // Update the internal data for the set values, as could take sometime once we emit the event
390
+ Object.entries(values).forEach(([key, value]) => {
391
+ if (this.deviceData[key] !== undefined) {
392
+ this.deviceData[key] = value;
393
+ }
394
+ });
384
395
  }
385
396
 
386
397
  async get(values) {
@@ -394,7 +405,7 @@ export default class HomeKitDevice {
394
405
  }
395
406
 
396
407
  // Send event with data to get
397
- // Once get has completed, we'll get an eevent back with the requested data
408
+ // Once get has completed, we'll get an event back with the requested data
398
409
  this.#eventEmitter.emit(HomeKitDevice.GET, this.deviceData.uuid, values);
399
410
 
400
411
  // This should always return, but we probably should put in a timeout?
@@ -402,7 +413,7 @@ export default class HomeKitDevice {
402
413
  return results?.[0];
403
414
  }
404
415
 
405
- async #message(type, message) {
416
+ #message(type, message) {
406
417
  switch (type) {
407
418
  case HomeKitDevice.ADD: {
408
419
  // Got message for device add
@@ -428,7 +439,7 @@ export default class HomeKitDevice {
428
439
  // This is not a message we know about, so pass onto accessory for it to perform any processing
429
440
  if (typeof this.messageServices === 'function') {
430
441
  try {
431
- await this.messageServices(type, message);
442
+ this.messageServices(type, message);
432
443
  } catch (error) {
433
444
  this?.log?.error &&
434
445
  this.log.error('messageServices call for device "%s" failed. Error was', this.deviceData.description, error);
@@ -8,6 +8,8 @@
8
8
  // -- Eve Degree/Weather2 history
9
9
  // -- Eve Water guard history
10
10
  //
11
+ // Credit to https://github.com/simont77/fakegato-history for the work on starting the EveHome comms protocol decoding
12
+ //
11
13
  // Version 29/8/2024
12
14
  // Mark Hulskamp
13
15
 
@@ -2073,15 +2075,6 @@ export default class HomeKitHistory {
2073
2075
  numberToEveHexString(1, 8),
2074
2076
  ); // first entry
2075
2077
 
2076
- if (this?.log?.debug) {
2077
- this.log.debug(
2078
- '#EveHistoryStatus: history for "%s:%s" (%s) - Entries %s',
2079
- this.EveHome.type,
2080
- this.EveHome.sub,
2081
- this.EveHome.evetype,
2082
- this.EveHome.count,
2083
- );
2084
- }
2085
2078
  return encodeEveData(value);
2086
2079
  }
2087
2080
 
@@ -2299,26 +2292,11 @@ export default class HomeKitHistory {
2299
2292
  }
2300
2293
  if (this.EveHome.entry > this.EveHome.count) {
2301
2294
  // No more history data to send back
2302
- this?.log?.debug &&
2303
- this.log.debug(
2304
- '#EveHistoryEntries: sent "%s" entries to EveHome ("%s") for "%s:%s"',
2305
- this.EveHome.send,
2306
- this.EveHome.evetype,
2307
- this.EveHome.type,
2308
- this.EveHome.sub,
2309
- );
2310
2295
  this.EveHome.send = 0; // no more to send
2311
2296
  dataStream += '00';
2312
2297
  }
2313
2298
  } else {
2314
2299
  // We're not transferring any data back
2315
- this?.log?.debug &&
2316
- this.log.debug(
2317
- '#EveHistoryEntries: no more entries to send to EveHome ("%s") for "%s:%s',
2318
- this.EveHome.evetype,
2319
- this.EveHome.type,
2320
- this.EveHome.sub,
2321
- );
2322
2300
  this.EveHome.send = 0; // no more to send
2323
2301
  dataStream = '00';
2324
2302
  }