homebridge-cmd4 6.3.0 → 7.0.0-beta2

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,38 +1,47 @@
1
1
  # Homebridges-cmd4 - CMD4 Plugin for Homebridge - Supports ~All Accessory Types and now all Characteristics too!!
2
- ### 6.3.0 (2022-04-12)
2
+ #### 7.0.0 (2023-03-05)
3
3
 
4
- ##### Bug Fixes
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.
6
+
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.
5
16
 
6
- * Bug [#130](https://github.com/ztalbot2000/homebridge-cmd4/pull/130), linked accessories not accesible after restart ([aeab5a40](https://github.com/ztalbot2000/homebridge-cmd4/commit/aeab5a40340631910ae6ac19f9af8453f46faa55))
7
17
 
8
18
  ##### New Features
9
- * Add new characteristics and device types ([c3560130](https://github.com/ztalbot2000/homebridge-cmd4/commit/c3560130e7092b698d0d750924c548a99c4e20f4))
10
- Characteristics
11
- ---------------
12
- AssetUpdateReadiness
13
- SupportedAssetTypes
14
- ConfigurationState
15
- NFCAccessControlPoint
16
- NFCAccessSupportedConfiguration
17
- SiriEndpointSessionStatus
18
- ThreadControlPoint
19
- ThreadNodeCapabilities
20
- ThreadStatus
21
- ThreadOpenThreadVersion
22
-
23
- Device Types
24
- ------------
25
- AccessoryMetrics
26
- AssetUpdate
27
- Assistant
28
- AudioStreamManagement
29
- Battery
30
- CameraRecordingManagement
31
- CloudRelay
32
- DataStreamTransportManagement
33
- NFCAccess
34
- SiriEndpoint
35
- ThreadTransport
36
-
37
- Note: While these are now available to use. Some may not be suitable for Cmd4 depending on their complexity.
19
+
20
+ * add retries. Also formatting issues ([b8ddf9ce](https://github.com/ztalbot2000/homebridge-cmd4/commit/b8ddf9ceda8ace3a6e820bfad0c4a03c656cf419))
21
+
22
+ ##### Documentation Changes
23
+
24
+ Beta2
25
+ * Update documentation for v7.0.0 ([12b6482a](https://github.com/ztalbot2000/homebridge-cmd4/commit/12b6482ac8e6d431e011f6f92c2d6f03a2ebe2ed))
26
+
27
+ ##### Bug Fixes
28
+
29
+ Beta2
30
+ * remove unwanted debug message and test so that it cannot reoccur ([97b6b318](https://github.com/ztalbot2000/homebridge-cmd4/commit/97b6b31861ab34d04b798ec409b1f2e8c56244c2))
31
+ * Homebridge does not like underscores of accessory names. Remove from default config.json ([15f2170b](https://github.com/ztalbot2000/homebridge-cmd4/commit/15f2170be492b6dfb56e4eed5d76da0cd4d74419))
32
+
33
+ Beta1
34
+ * retry logging starts from zero, but for user count starts from 1 ([38cdf417](https://github.com/ztalbot2000/homebridge-cmd4/commit/38cdf417feebeef2b75dcfec247e6bdfd4739604))
35
+ * By nature retryCount should start from zero ([b8e82ffe](https://github.com/ztalbot2000/homebridge-cmd4/commit/b8e82ffe262c092a301636993544be828a7a34a4))
36
+ * log message in wrong quotes ([6fc555b0](https://github.com/ztalbot2000/homebridge-cmd4/commit/6fc555b0d7bdc20bfc3a38310e3d4f66b968d55d))
37
+ * retries for WoRm should be zero. Can be overriden ([11351633](https://github.com/ztalbot2000/homebridge-cmd4/commit/1135163319c8d16e3886dbf0a0443ba5ed6c4b99))
38
+ * Accessory needs to go unresponsive via updateValue with error object ([cdfee1b2](https://github.com/ztalbot2000/homebridge-cmd4/commit/cdfee1b22ea21dc56edc320768ec6ebea1156cb8))
39
+
40
+ ##### Tests
41
+
42
+ * put back skipped tests ([0b0781fa](https://github.com/ztalbot2000/homebridge-cmd4/commit/0b0781faec7f94e43d67068e15e9505cc7c96414))
43
+ * Remove excess debug messages for commit with verify to work ([ea108470](https://github.com/ztalbot2000/homebridge-cmd4/commit/ea108470631f4abe3377f6d582c962dab141be0f))
44
+ * 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))
45
+ * 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))
46
+
38
47
 
package/Cmd4Accessory.js CHANGED
@@ -10,7 +10,7 @@ let Logger = require( "./utils/Logger" );
10
10
  const { getAccessoryName, getAccessoryDisplayName
11
11
  } = require( "./utils/getAccessoryNameFunctions" );
12
12
  let getAccessoryUUID = require( "./utils/getAccessoryUUID" );
13
- const { addQueue, parseAddQueueTypes, queueExists } = require( "./Cmd4PriorityPollingQueue" );
13
+ const { addQueue, queueExists } = require( "./Cmd4PriorityPollingQueue" );
14
14
 
15
15
  // Hierarchy variables
16
16
  let HV = require( "./utils/HV" );
@@ -127,6 +127,10 @@ class Cmd4Accessory
127
127
  this.listOfVariables = { };
128
128
  this.listOfConstants = { };
129
129
 
130
+ // Determines if the accessory is communicable
131
+ this.errorValue = 0;
132
+ this.errorString = "init";
133
+
130
134
  // Used to determine missing related characteristics and
131
135
  // to determine if the related characteristic is also polled.
132
136
  this.listOfPollingCharacteristics = { };
@@ -1549,21 +1553,6 @@ class Cmd4Accessory
1549
1553
  else
1550
1554
  this.statusMsg = "FALSE";
1551
1555
 
1552
- break;
1553
- case "QueueStatMsgInterval":
1554
- case "QueueMsg":
1555
-
1556
- // Never put into production
1557
- this.log.warn( `Warning: ${ key } has been deprecated. It was never even used.` );
1558
- this.log.warn( `To remove this message, just remove ${ key } from your config.json` );
1559
-
1560
- break;
1561
- case constants.QUEUETYPES:
1562
- this.log.warn( `Warning: ${ key } will soon been deprecated at the accessory level. Please move it to where "Platform: "Cmd4" is located in your config.json.` );
1563
- this.log.warn( `This message will disappear when you have done so.` );
1564
-
1565
- parseAddQueueTypes( this.log, value );
1566
-
1567
1556
  break;
1568
1557
  case constants.QUEUE:
1569
1558
  {
@@ -1588,12 +1577,6 @@ class Cmd4Accessory
1588
1577
  // Do not parse it yet as characteristics must be set first.
1589
1578
  this.polling = value;
1590
1579
 
1591
- break;
1592
- case "Cmd4_Mode":
1593
- case "cmd4_Mode":
1594
- this.log.warn( `Warning: ${ key } has been deprecated.` );
1595
- cmd4Mode = value;
1596
-
1597
1580
  break;
1598
1581
  case constants.INTERVAL:
1599
1582
  // Intervals are in seconds
@@ -1621,34 +1604,6 @@ class Cmd4Accessory
1621
1604
  // What this plugin is all about
1622
1605
  this.state_cmd = value;
1623
1606
 
1624
- break;
1625
- case constants.STORAGE:
1626
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
1627
- this.log.warn( `This message will disappear when you have done so.` );
1628
-
1629
- this.storage = value;
1630
-
1631
- break;
1632
- case constants.STORAGEPATH:
1633
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
1634
- this.log.warn( `This message will disappear when you have done so.` );
1635
-
1636
- this.storagePath = value
1637
-
1638
- break;
1639
- case constants.FOLDER:
1640
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
1641
- this.log.warn( `This message will disappear when you have done so.` );
1642
-
1643
- this.folder = value
1644
-
1645
- break;
1646
- case constants.KEYPATH:
1647
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
1648
- this.log.warn( `This message will disappear when you have done so.` );
1649
-
1650
- this.keyPath = value
1651
-
1652
1607
  break;
1653
1608
  case constants.FAKEGATO:
1654
1609
  // Do not parse it yet as characteristics must be set first.
@@ -1891,7 +1846,6 @@ class Cmd4Accessory
1891
1846
  let interval = accessory.hV.interval;
1892
1847
  let stateChangeResponseTime = accessory.hV.stateChangeResponseTime;
1893
1848
 
1894
-
1895
1849
  // We need to create the listOfPollingCharacteristics, even in Demo mode because
1896
1850
  // this list is also used to determine if the related characteristic should be set
1897
1851
  // which happens in the Demo mode without polling.
@@ -1948,20 +1902,13 @@ class Cmd4Accessory
1948
1902
  stateChangeResponseTime = value * 1000;
1949
1903
 
1950
1904
  break;
1951
- case constants.QUEUE:
1952
- {
1953
- if ( this.queue && this.queue.queueName != value )
1954
- throw new Error( chalk.red( `Already defined Priority Polling Queue "${ this.queue.queueName }" for ${ this.displayName } cannot be redefined.` ) );
1955
-
1956
- this.log.warn( `Warning: ${ key } will soon been deprecated at the polling level. Please define it for the accessory: ${ this.displayName } as "queue": "${ value }"` );
1957
- this.log.warn( `This message will disappear when you have done so.` );
1958
-
1959
- this.queue = addQueue( this.log, value, constants.QUEUETYPE_WORM );
1960
-
1961
- break;
1962
- }
1963
1905
  case constants.CHARACTERISTIC:
1964
1906
  {
1907
+ // The key must be a characteristic property
1908
+ // but first check if one has already been defined as we can only handle one at a time.
1909
+ if ( accTypeEnumIndex != -1 )
1910
+ throw new Error( `For charateristic polling, you can only define one characteristic per array item.\nCannot add "${ key }" as "${ value }" is already defined for: ${ accessory.displayName } ${accTypeEnumIndex}` );
1911
+
1965
1912
  rcDirective = isAccDirective( value, false );
1966
1913
  if ( rcDirective.accTypeEnumIndex == null )
1967
1914
  {
@@ -1979,29 +1926,10 @@ class Cmd4Accessory
1979
1926
 
1980
1927
  break;
1981
1928
  }
1982
- case constants.QUEUETYPES:
1983
- {
1984
- // WHY IS THIS HERE AT ALL ??????????
1985
-
1986
- this.log.warn( `Warning: ${ key } will soon been deprecated at the accessory level. Please move it to where "Platform: "Cmd4" is located in your config.json.` );
1987
- this.log.warn( `This message will disappear when you have done so.` );
1988
-
1989
- parseAddQueueTypes( this.log, value );
1990
- // This whole record is not a characteristic polling entry
1991
- // continue to next ( via return )
1992
- return;
1993
- }
1994
- default:
1929
+ default: // Switching polling key but key is unknown
1995
1930
  {
1996
- // The key must be a characteristic property
1997
- // but first check if one has already been defined as we can only handle one at a time.
1998
- if ( accTypeEnumIndex != -1 )
1999
- throw new Error( `For charateristic polling, you can only define one characteristic per array item.\nCannot add "${ key }" as "${ characteristicString }" is already defined for: ${ accessory.displayName }` );
2000
1931
 
2001
- // This checks both upper and lower case
2002
- accTypeEnumIndex = CMD4_ACC_TYPE_ENUM.indexOfEnum( key );
2003
- if ( accTypeEnumIndex < 0 )
2004
- throw new Error( `No such polling characteristic: "${ key }" for: "${ accessory.displayName }".` );
1932
+ throw new Error( `No such polling characteristic: "${ key }" for: "${ accessory.displayName }".` );
2005
1933
 
2006
1934
  }
2007
1935
  }
@@ -2010,13 +1938,17 @@ class Cmd4Accessory
2010
1938
  // Everything now goes through the queue
2011
1939
  if ( this.queue == null )
2012
1940
  {
2013
- this.queue = addQueue( this.log, "Q:" + this.displayName, constants.QUEUETYPE_STANDARD );
1941
+ this.queue = addQueue( this.log, "Q:" + this.displayName, constants.QUEUETYPE_STANDARD, constants.DEFAULT_STANDARD_QUEUE_RETRY_COUNT );
2014
1942
  }
2015
1943
  // This has to be UC as it gets passed to the getValue cmd string
2016
1944
  let characteristicString = CMD4_ACC_TYPE_ENUM.accEnumIndexToUC( accTypeEnumIndex );
2017
1945
 
2018
1946
  if ( settings.cmd4Dbg ) this.log.debug( `Setting up accessory: ${ accessory.displayName } for polling of: ${ characteristicString } timeout: ${ timeout } interval: ${ interval } queueName: "${ this.queue.queueName }"` );
2019
1947
 
1948
+ if ( timeout == undefined )
1949
+ throw new Error( `determineCharacteristicsToPollForAccessory Timeout is undefined ` );
1950
+
1951
+
2020
1952
  let record = { [ constants.ACCESSORY_lv ]: accessory, [ constants.ACC_TYPE_ENUM_INDEX_lv ]: accTypeEnumIndex, [ constants.CHARACTERISTIC_STRING_lv ]: characteristicString, [ constants.INTERVAL_lv ]: interval, [ constants.TIMEOUT_lv ]: timeout, [ constants.STATE_CHANGE_RESPONSE_TIME_lv ]: stateChangeResponseTime, [ constants.QUEUE_NAME_lv ]: this.queue.queueName };
2021
1953
 
2022
1954
  // Used to determine missing related characteristics and
@@ -2040,7 +1972,7 @@ class Cmd4Accessory
2040
1972
  // which happens in the Demo mode without polling.
2041
1973
  if ( this.queue == null )
2042
1974
  {
2043
- this.queue = addQueue( this.log, "Q:" + this.displayName, constants.QUEUETYPE_STANDARD );
1975
+ this.queue = addQueue( this.log, "Q:" + this.displayName, constants.QUEUETYPE_STANDARD, constants.DEFAULT_STANDARD_QUEUE_RETRY_COUNT );
2044
1976
  }
2045
1977
 
2046
1978
  // Make sure the defined characteristics will be polled
@@ -2049,6 +1981,7 @@ class Cmd4Accessory
2049
1981
 
2050
1982
  // This has to be UC as it gets passed to the getValue cmd string
2051
1983
  let characteristicString = CMD4_ACC_TYPE_ENUM.accEnumIndexToUC( defaultPollingAccTypeEnumIndex );
1984
+
2052
1985
  let record = { [ constants.ACCESSORY_lv ]: accessory, [ constants.ACC_TYPE_ENUM_INDEX_lv ]: defaultPollingAccTypeEnumIndex, [ constants.CHARACTERISTIC_STRING_lv ]: characteristicString, [ constants.INTERVAL_lv ]: interval, [ constants.TIMEOUT_lv ]: timeout, [ constants.STATE_CHANGE_RESPONSE_TIME_lv ]: stateChangeResponseTime, [ constants.QUEUE_NAME_lv ]: this.queue.queueName };
2053
1986
 
2054
1987
  // Used to determine missing related characteristics and
package/Cmd4Platform.js CHANGED
@@ -237,70 +237,15 @@ class Cmd4Platform
237
237
  case constants.OUTPUTCONSTANTS:
238
238
  this.outputConstants = value;
239
239
 
240
- break;
241
- case "RestartRecover":
242
- this.log.warn( `Warning: ${ key } has been deprecated. Not having restart recovery could mean your device would turn on/off over a restart; Therefore ${ key } is now always enabled.` );
243
- this.log.warn( `To remove this message, just remove ${ key } from your config.json` );
244
240
  break;
245
241
  case constants.STATUSMSG:
246
242
  if ( value === false )
247
243
  this.statusMsg = "FALSE";
248
244
 
249
- break;
250
- case "QueueStatMsgInterval":
251
- case "QueueMsg":
252
-
253
- // Never put into production
254
- this.log.warn( `Warning: ${ key } has been deprecated. It was never even used.` );
255
- this.log.warn( `To remove this message, just remove ${ key } from your config.json` );
256
-
257
245
  break;
258
246
  case constants.QUEUETYPES:
259
247
  parseAddQueueTypes( this.log, value );
260
248
 
261
- break;
262
- case "Cmd4_Mode":
263
- case "cmd4_Mode":
264
- this.log.warn( `Warning: ${ key } has been deprecated.` );
265
- if ( value == "Demo" )
266
- {
267
- this.log.warn( `Demo mode is achieved when there is not any polling entries in your config.json.` );
268
- } else
269
- {
270
- this.log.warn( `Cmd4 has been simplified and optimized as per: https://git.io/JtMGR.` );
271
- }
272
- this.log.warn( `To remove this message, just remove "${ key }" from your config.json` );
273
- break;
274
- case constants.STORAGE:
275
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
276
- this.log.warn( `This message will disappear when you have done so.` );
277
-
278
- if ( value == constants.FS || value == constants.GOOGLEDRIVEl )
279
- this.storage = value;
280
- else
281
- this.log.warn( chalk.yellow( `WARNING` ) + `: Cmd4 Unknown platform.config.storage:{ this.storage } Expected:${ constants.FS } or ${ constants.GOOGLEDRIVE }` );
282
-
283
- break;
284
- case constants.STORAGEPATH:
285
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
286
- this.log.warn( `This message will disappear when you have done so.` );
287
-
288
- this.storagePath = value;
289
-
290
- break;
291
- case constants.FOLDER:
292
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
293
- this.log.warn( `This message will disappear when you have done so.` );
294
-
295
- this.folder = value;
296
-
297
- break;
298
- case constants.KEYPATH:
299
- this.log.warn( `Warning: ${ key } will soon been deprecated at the Platform level. It was always meant to just be a fakegato config option only.` );
300
- this.log.warn( `This message will disappear when you have done so.` );
301
-
302
- this.keyPath = value;
303
-
304
249
  break;
305
250
  case constants.DEFINITIONS:
306
251
  this.definitions = value;