homebridge-cmd4 7.0.0 → 7.0.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/CHANGELOG.md CHANGED
@@ -1,37 +1,8 @@
1
1
  # Homebridges-cmd4 - CMD4 Plugin for Homebridge - Supports ~All Accessory Types and now all Characteristics too!!
2
- #### 7.0.0 (2023-03-05)
2
+ ### 7.0.2 (2023-12-24)
3
3
 
4
- * The reason for the major version numbering update was to for deprecation warnings to throw an error.
5
- These warnings were there for many major versions and are finally removed.
4
+ ##### Change affecting AdvAir by their request
6
5
 
7
- "queueInterval" - Never put into production and will now throw an error.
8
- "queueMsg" - Never put into production and will now throw an error.
9
- "queueStatMsgInterval" - Never put into production and will now throw an error.
10
- "cmd4_Mode" - Obsolete for many versions and will now throw an error.
11
- "storage" - Obsolete outside of fakegato definition.
12
- "storagePath" - Obsolete outside of fakegato definition.
13
- "folder" - Obsolete outside of fakegato definition.
14
- "keyPath" - Obsolete outside of fakegato definition.
15
- "queueTypes" - Obsolete inside accessory definition.
16
-
17
-
18
- ##### New Features
19
-
20
- * add retries. Also formatting issues ([b8ddf9ce](https://github.com/ztalbot2000/homebridge-cmd4/commit/b8ddf9ceda8ace3a6e820bfad0c4a03c656cf419))
21
-
22
- ##### Bug Fixes
23
-
24
- * retry logging starts from zero, but for user count starts from 1 ([38cdf417](https://github.com/ztalbot2000/homebridge-cmd4/commit/38cdf417feebeef2b75dcfec247e6bdfd4739604))
25
- * By nature retryCount should start from zero ([b8e82ffe](https://github.com/ztalbot2000/homebridge-cmd4/commit/b8e82ffe262c092a301636993544be828a7a34a4))
26
- * log message in wrong quotes ([6fc555b0](https://github.com/ztalbot2000/homebridge-cmd4/commit/6fc555b0d7bdc20bfc3a38310e3d4f66b968d55d))
27
- * retries for WoRm should be zero. Can be overriden ([11351633](https://github.com/ztalbot2000/homebridge-cmd4/commit/1135163319c8d16e3886dbf0a0443ba5ed6c4b99))
28
- * Accessory needs to go unresponsive via updateValue with error object ([cdfee1b2](https://github.com/ztalbot2000/homebridge-cmd4/commit/cdfee1b22ea21dc56edc320768ec6ebea1156cb8))
29
-
30
- ##### Tests
31
-
32
- * put back skipped tests ([0b0781fa](https://github.com/ztalbot2000/homebridge-cmd4/commit/0b0781faec7f94e43d67068e15e9505cc7c96414))
33
- * Remove excess debug messages for commit with verify to work ([ea108470](https://github.com/ztalbot2000/homebridge-cmd4/commit/ea108470631f4abe3377f6d582c962dab141be0f))
34
- * Don't know why HomeKit does not cause Cmd4 to generate a log that it is trying to reconnect after unavailable ([d45d7c09](https://github.com/ztalbot2000/homebridge-cmd4/commit/d45d7c095d0989c05b88c161a418402711e26677))
35
- * Add unit testing to prove fix of bug[#130](https://github.com/ztalbot2000/homebridge-cmd4/pull/130) ([e9a902fc](https://github.com/ztalbot2000/homebridge-cmd4/commit/e9a902fcb01fb2ee7c7cb9f2b60e036d0fd5c0d6))
6
+ * For AdvAir.sh put accessory name in double quotes so it can contain a single quote ([023e91c0](https://github.com/ztalbot2000/homebridge-cmd4/commit/023e91c0bf1794a64bf0e18dec7d31b178ecb6d1))
36
7
 
37
8
 
@@ -208,23 +208,23 @@ class Cmd4PriorityPollingQueue
208
208
  // Since the "Set" passed, do the stateChangeResponseTime
209
209
  setTimeout( ( ) =>
210
210
  {
211
- // A set with no error means the queue is sane to do reading
212
- queue.lastGoodTransactionTime = Date.now( );
213
- queue.errorCountSinceLastGoodTransaction = 0;
211
+ // A set with no error means the queue is sane to do reading
212
+ queue.lastGoodTransactionTime = Date.now( );
213
+ queue.errorCountSinceLastGoodTransaction = 0;
214
214
 
215
- // After the stateChangeResponseTime, do the related characteristic ( if any )
216
- let relatedCurrentAccTypeEnumIndex = entry.accessory.getDevicesRelatedCurrentAccTypeEnumIndex( entry.accTypeEnumIndex );
215
+ // After the stateChangeResponseTime, do the related characteristic ( if any )
216
+ let relatedCurrentAccTypeEnumIndex = entry.accessory.getDevicesRelatedCurrentAccTypeEnumIndex( entry.accTypeEnumIndex );
217
217
 
218
218
  if ( relatedCurrentAccTypeEnumIndex != null )
219
- {
220
- let relatedCurrentCharacteristicString = CMD4_ACC_TYPE_ENUM.properties[ relatedCurrentAccTypeEnumIndex ].type;
221
- // Change the entry to a get and set queueGetIsUpdate to true
222
- // Use unshift to make it next in line
223
- entry.isSet = false;
224
- entry.accTypeEnumIndex = relatedCurrentAccTypeEnumIndex;
225
- entry.characteristicString = relatedCurrentCharacteristicString;
226
- entry.queueGetIsUpdate = true;
227
- queue.highPriorityQueue.unshift( entry );
219
+ {
220
+ let relatedCurrentCharacteristicString = CMD4_ACC_TYPE_ENUM.properties[ relatedCurrentAccTypeEnumIndex ].type;
221
+ // Change the entry to a get and set queueGetIsUpdate to true
222
+ // Use unshift to make it next in line
223
+ entry.isSet = false;
224
+ entry.accTypeEnumIndex = relatedCurrentAccTypeEnumIndex;
225
+ entry.characteristicString = relatedCurrentCharacteristicString;
226
+ entry.queueGetIsUpdate = true;
227
+ queue.highPriorityQueue.unshift( entry );
228
228
  }
229
229
 
230
230
  // The "Set" is now complete after its stateChangeResponseTime.
@@ -232,7 +232,7 @@ class Cmd4PriorityPollingQueue
232
232
 
233
233
  setTimeout( ( ) => { queue.processQueueFunc( HIGH_PRIORITY_GET, queue ); }, 0 );
234
234
 
235
- return;
235
+ return;
236
236
 
237
237
  }, entry.stateChangeResponseTime );
238
238
 
@@ -374,8 +374,9 @@ class Cmd4PriorityPollingQueue
374
374
  // Save the new value
375
375
  entry.accessory.cmd4Storage.setStoredValueForIndex( entry.accTypeEnumIndex, properValue );
376
376
 
377
+ if ( settings.cmd4Dbg ) entry.accessory.log.debug( `processEntryFromLowPriorityQueue calling updateValue properValue: ${ properValue }`);
378
+
377
379
  // Update the new value in homebridge
378
- entry.accessory.log.warn( `processEntryFromLowPriorityQueue calling updateValue properValue: ${ properValue }`);
379
380
  entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( properValue );
380
381
 
381
382
  // A good anything, updates the lastGoodTransactionTime
@@ -425,7 +426,14 @@ class Cmd4PriorityPollingQueue
425
426
  let self = accessory;
426
427
  let queue = accessory.queue;
427
428
 
428
- let cmd = self.state_cmd_prefix + self.state_cmd + " Get '" + self.displayName + "' '" + characteristicString + "'" + self.state_cmd_suffix;
429
+ let cmd = self.state_cmd_prefix + self.state_cmd + " Get '" + self.displayName + "' '" + characteristicString + "'" + self.state_cmd_suffix;
430
+
431
+ // My AdvAir friends want to allow single quotes in accessory names, which
432
+ // may have consequences with globbing for others.
433
+ if ( self.state_cmd.match( /AdvAir.sh/ ) )
434
+ {
435
+ cmd = self.state_cmd_prefix + self.state_cmd + ' Get "' + self.displayName + '" ' + "'" + characteristicString + "'" + self.state_cmd_suffix;
436
+ }
429
437
 
430
438
  if ( settings.cmd4Dbg ) self.log.debug( `getValue: accTypeEnumIndex:( ${ accTypeEnumIndex } )-"${ characteristicString }" function for: ${ self.displayName } cmd: ${ cmd } timeout: ${ timeout }` );
431
439
 
@@ -607,7 +615,14 @@ class Cmd4PriorityPollingQueue
607
615
  value = transposeBoolToValue( value );
608
616
  }
609
617
 
610
- let cmd = accessory.state_cmd_prefix + accessory.state_cmd + " Set '" + accessory.displayName + "' '" + characteristicString + "' '" + value + "'" + accessory.state_cmd_suffix;
618
+ let cmd = accessory.state_cmd_prefix + accessory.state_cmd + " Set '" + accessory.displayName + "' '" + characteristicString + "' '" + value + "'" + accessory.state_cmd_suffix;
619
+
620
+ // My AdvAir friends want to allow single quotes in accessory names, which
621
+ // may have consequences with globbing for others.
622
+ if ( accessory.state_cmd.match( /AdvAir.sh/ ) )
623
+ {
624
+ cmd = accessory.state_cmd_prefix + accessory.state_cmd + ' Set "' + accessory.displayName + '" ' + "'" + characteristicString + "' '" + value + "'" + accessory.state_cmd_suffix;
625
+ }
611
626
 
612
627
  if ( accessory.hV.statusMsg == "TRUE" )
613
628
  self.log.info( chalk.blue( `Setting ${ self.displayName } ${ characteristicString }` ) + ` ${ value }` );
@@ -832,10 +847,14 @@ class Cmd4PriorityPollingQueue
832
847
  let nextEntry = queue.highPriorityQueue[ 0 ];
833
848
 
834
849
  if ( nextEntry.isSet == true )
850
+ {
835
851
 
836
852
  queue.processHighPrioritySetQueue( queue.highPriorityQueue.shift( ) );
853
+ }
837
854
  else
855
+ {
838
856
  queue.processHighPriorityGetQueue( queue.highPriorityQueue.shift( ) );
857
+ }
839
858
  }
840
859
  }
841
860