homebridge-cmd4 7.1.0 → 8.0.0-beta.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 +10 -4
- package/Cmd4Accessory.js +11 -9
- package/Cmd4Platform.js +2 -1
- package/Extras/Cmd4Scripts/State.js +8 -1
- package/RUNNING_CHANGELOG.md +20 -0
- package/docs/Developers.md +2 -42
- package/index.js +2 -2
- package/lib/CMD4_ACC_TYPE_ENUM.js +1108 -835
- package/lib/CMD4_CHAR_TYPE_ENUMS.js +28 -28
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# Homebridges-cmd4 - CMD4 Plugin for Homebridge - Supports ~All Accessory Types and now all Characteristics too!!
|
|
2
|
-
###
|
|
2
|
+
### 8.0.0 (2024-06-28)
|
|
3
3
|
|
|
4
4
|
##### Documentation Changes
|
|
5
|
+
* Document changes for homebridge v2 where TargetAirQuality and TargetSlatState are deprecated ([80ef143](https://github.com/ztalbot2000/homebridge-cmd4/commit/80ef143fa68ff7abedd6bcf4b715d2dab3ae8451))
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
##### Bug Fixes
|
|
8
|
+
* fix for homebridge v2 where TargetSlateStte and TargetAirQuality are deprecated ([6acfbb2](https://github.com/ztalbot2000/homebridge-cmd4/commit/6acfbb26bf56a355d76f3f96dafabdfefd26bbb6))
|
|
9
|
+
* Fix for homebridge v2 Formats&Perms&Units only available directly from HAP ([2a9d6e9](https://github.com/ztalbot2000/homebridge-cmd4/commit/2a9d6e976647f1fa7e1a3ee34e5080a3c28eae73))
|
|
10
|
+
* Fix lint error ([286dc68](https://github.com/ztalbot2000/homebridge-cmd4/commit/286dc68441c776a93f0f0d913db326fa9ccafeec))
|
|
11
|
+
|
|
12
|
+
* Fix for homebridge v2 Formats&Perms&Units only available directly from HAP ([999f226](https://github.com/ztalbot2000/homebridge-cmd4/commit/999f226855de026b3bb0e9ecdd237fc7d0976f22))
|
|
7
13
|
|
|
8
|
-
##### New Features
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
##### New Features
|
|
11
16
|
|
|
17
|
+
* Support only Platform Accessories as per Homebridge recommendation ([0ee6efc](https://github.com/ztalbot2000/homebridge-cmd4/commit/0ee6efcc09b7c87f346299fb9ccab5940fba7ee0))
|
|
12
18
|
|
package/Cmd4Accessory.js
CHANGED
|
@@ -394,7 +394,7 @@ class Cmd4Accessory
|
|
|
394
394
|
let format = CMD4_ACC_TYPE_ENUM.properties[ accTypeEnumIndex ].props.format;
|
|
395
395
|
|
|
396
396
|
// No matter what, remove it
|
|
397
|
-
if ( format == this.api.hap.
|
|
397
|
+
if ( format == this.api.hap.Formats.TLV8 && this.hV.allowTLV8 == false )
|
|
398
398
|
{
|
|
399
399
|
if ( this.cmd4Storage.getStoredValueForIndex( accTypeEnumIndex ) != null )
|
|
400
400
|
{
|
|
@@ -843,10 +843,10 @@ class Cmd4Accessory
|
|
|
843
843
|
// - CurrentTemperature
|
|
844
844
|
// - CurrentHeatingCoolingState
|
|
845
845
|
// - StatusFault
|
|
846
|
-
if ( perms.indexOf( this.api.hap.
|
|
847
|
-
perms.indexOf( this.api.hap.
|
|
848
|
-
perms.indexOf( this.api.hap.
|
|
849
|
-
perms.indexOf( this.api.hap.
|
|
846
|
+
if ( perms.indexOf( this.api.hap.Perms.READ ) >= 0 &&
|
|
847
|
+
perms.indexOf( this.api.hap.Perms.WRITE ) == -1 ||
|
|
848
|
+
perms.indexOf( this.api.hap.Perms.PAIRED_READ ) >= 0 &&
|
|
849
|
+
perms.indexOf( this.api.hap.Perms.PAIRED_WRITE ) == -1 )
|
|
850
850
|
{
|
|
851
851
|
accessory.service.setCharacteristic(
|
|
852
852
|
CMD4_ACC_TYPE_ENUM.properties[ accTypeEnumIndex ].characteristic,
|
|
@@ -860,7 +860,7 @@ class Cmd4Accessory
|
|
|
860
860
|
.characteristic ).listeners( "get" ).length == 0 )
|
|
861
861
|
{
|
|
862
862
|
// Add Read services for characterisitcs, if possible
|
|
863
|
-
if ( perms.indexOf( this.api.hap.
|
|
863
|
+
if ( perms.indexOf( this.api.hap.Perms.READ ) != -1 )
|
|
864
864
|
{
|
|
865
865
|
|
|
866
866
|
// getCachedValue or getValue
|
|
@@ -896,7 +896,7 @@ class Cmd4Accessory
|
|
|
896
896
|
.characteristic ).listeners( "set" ).length == 0 )
|
|
897
897
|
{
|
|
898
898
|
// Add Write services for characterisitcs, if possible
|
|
899
|
-
if ( perms.indexOf( this.api.hap.
|
|
899
|
+
if ( perms.indexOf( this.api.hap.Perms.WRITE ) != -1 )
|
|
900
900
|
{
|
|
901
901
|
// setCachedValue or setValue
|
|
902
902
|
if ( ! accessory.polling ||
|
|
@@ -1515,8 +1515,10 @@ class Cmd4Accessory
|
|
|
1515
1515
|
|
|
1516
1516
|
break;
|
|
1517
1517
|
case constants.ACCESSORY:
|
|
1518
|
-
//
|
|
1519
|
-
|
|
1518
|
+
// For 8.0 this is no longer supported. Homebridge has deprecated
|
|
1519
|
+
// the template and only wants Platform templates which makes
|
|
1520
|
+
// it easier for Cmd4 to support homebridge-ui as well..
|
|
1521
|
+
throw new Error( `Accessory: has been deprecated by homebridge. Only Platform confgurations are supported by Cmd4 >= 8.0 for: "${ this.displayName }".` );
|
|
1520
1522
|
case constants.CATEGORY:
|
|
1521
1523
|
// For those who define there own Category
|
|
1522
1524
|
// Uppercase the category to be nice. Why do I know
|
package/Cmd4Platform.js
CHANGED
|
@@ -545,7 +545,8 @@ class Cmd4Platform
|
|
|
545
545
|
|
|
546
546
|
|
|
547
547
|
// Just a flag to say we have processed this existing platform accessory.
|
|
548
|
-
|
|
548
|
+
// @deprecated homebridge v2
|
|
549
|
+
//platform.updateReachability( true );
|
|
549
550
|
|
|
550
551
|
|
|
551
552
|
// For Unit testing only
|
|
@@ -505,7 +505,14 @@ switch( io )
|
|
|
505
505
|
{
|
|
506
506
|
c = readData( device, characteristic );
|
|
507
507
|
|
|
508
|
-
|
|
508
|
+
//validValues:
|
|
509
|
+
// "PLAY"
|
|
510
|
+
// "PAUSE"
|
|
511
|
+
// "STOP"
|
|
512
|
+
// "LOADING"
|
|
513
|
+
// "INTERRUPTED"
|
|
514
|
+
|
|
515
|
+
if ( c == "" ) process.stdout.write( "STOP" ); else process.stdout.write( `"${ c }"` );
|
|
509
516
|
|
|
510
517
|
break;
|
|
511
518
|
}
|
package/RUNNING_CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## ChangeLog
|
|
7
|
+
* <a href="#Whats-new-in-8-0-0">**Whats new in 8.0.0**</a>
|
|
7
8
|
* <a href="#Whats-new-in-7-1-0">**Whats new in 7.1.0**</a>
|
|
8
9
|
* <a href="#Whats-new-in-7-0-3">**Whats new in 7.0.3**</a>
|
|
9
10
|
* <a href="#Whats-new-in-7-0-2">**Whats new in 7.0.2**</a>
|
|
@@ -91,6 +92,25 @@
|
|
|
91
92
|
* <a href="#Whats-new-in-2-1">**Whats new in 2.1**</a>
|
|
92
93
|
* <a href="#Whats-new-in-2-0">**Whats new in 2.0**</a>
|
|
93
94
|
|
|
95
|
+
<a name="Whats-new-in-8-0-0">## Whats new in 8.0.0</a>
|
|
96
|
+
### 8.0.0 (2024-06-28)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
##### Documentation Changes
|
|
100
|
+
* Document changes for homebridge v2 where TargetAirQuality and TargetSlatState are deprecated ([80ef143](https://github.com/ztalbot2000/homebridge-cmd4/commit/80ef143fa68ff7abedd6bcf4b715d2dab3ae8451))
|
|
101
|
+
|
|
102
|
+
##### Bug Fixes
|
|
103
|
+
* fix for homebridge v2 where TargetSlateStte and TargetAirQuality are deprecated ([6acfbb2](https://github.com/ztalbot2000/homebridge-cmd4/commit/6acfbb26bf56a355d76f3f96dafabdfefd26bbb6))
|
|
104
|
+
* Fix for homebridge 2 Formats&Perms&Units only available directly from HAP ([2a9d6e9](https://github.com/ztalbot2000/homebridge-cmd4/commit/2a9d6e976647f1fa7e1a3ee34e5080a3c28eae73))
|
|
105
|
+
|
|
106
|
+
* Fix lint error ([286dc68](https://github.com/ztalbot2000/homebridge-cmd4/commit/286dc68441c776a93f0f0d913db326fa9ccafeec))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
##### New Features
|
|
110
|
+
|
|
111
|
+
* Support only Platform Accessories as per Homebridge recommendation ([0ee6efc](https://github.com/ztalbot2000/homebridge-cmd4/commit/0ee6efcc09b7c87f346299fb9ccab5940fba7ee0))
|
|
112
|
+
|
|
113
|
+
|
|
94
114
|
<a name="Whats-new-in-7-1-0">## Whats new in 7.1.0</a>
|
|
95
115
|
### 7.1.0 (2024-03-04)
|
|
96
116
|
|
package/docs/Developers.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* [**Homebridge API**](#homebridge-api)
|
|
9
9
|
* [**Platform Accessories**](#platform-accessories)
|
|
10
10
|
* [**Television Accessories**](#television-accessories)
|
|
11
|
-
* [**Standard Accessories**](#standard-accessories)
|
|
12
11
|
* [**Cmd4 Directives**](#cmd4-directives)
|
|
13
12
|
* [**Cmd4 Devices and Characteristics**](#cmd4-devices-and-characteristics)
|
|
14
13
|
* [**Priority Queued Polling**](#priority-queued-polling)
|
|
@@ -31,12 +30,11 @@
|
|
|
31
30
|
* [**cmd4-HisenseTV**](https://github.com/mitch7391/cmd4-HisenseTV/blob/main/HisenseTV.sh)
|
|
32
31
|
|
|
33
32
|
## Homebridge API
|
|
34
|
-
Cmd4 is not possible without Homebridge.
|
|
35
|
-
<BR>Note: The major difference in CMD4 Version 3 is that the default accessory created is a Platform Plugin as compared to an Accessory Plugin. This is beneficial as many more Platform with the same type can be created and they can be published externally as we shall see.
|
|
33
|
+
Cmd4 is not possible without Homebridge. As of Cmd4 Version >= 8, Cmd4 only follows the Platform template definition as dictated by Homebridge. See: [deprecated templates](https://developers.homebridge.io/#/). This was everyone anyway and makes homebridge-ui easier to implement for Cmd4..<BR>
|
|
36
34
|
|
|
37
35
|
|
|
38
36
|
## Platform Accessories
|
|
39
|
-
|
|
37
|
+
An example Cmd4 Platform accessory for a Homebridge Television as described by: [Homebridge Television](https://developers.homebridge.io/#/service/Television) is:
|
|
40
38
|
|
|
41
39
|
```json
|
|
42
40
|
{
|
|
@@ -152,44 +150,6 @@ As per the Homebridge API, this allows the Platform Accessory to be published se
|
|
|
152
150
|
|
|
153
151
|
See the [Cmd4 Developers Guide](https://github.com/ztalbot2000/homebridge-cmd4/blob/master/docs/Developers.md) for further information.
|
|
154
152
|
|
|
155
|
-
## Standard Accessories
|
|
156
|
-
A Standard Accessory does not need a Platform. The Homebridge example given is. [Homebridge Switch](https://developers.homebridge.io/#/api/accessory-plugins). Cmd4 Version 3 can recreate the exact same configuration as:
|
|
157
|
-
<BR>
|
|
158
|
-
For upcoming Cmd4 version 8.0 this will no longer be supported. This is because of <a href="https://developers.homebridge.io/#/">Homebridge deprecated templates</a>.This will also make homebridge-ui easier to implement.
|
|
159
|
-
|
|
160
|
-
```json
|
|
161
|
-
{
|
|
162
|
-
"bridge": {
|
|
163
|
-
"name": "MAC Test Homebridge",
|
|
164
|
-
"username": "CC:22:3D:E3:CE:30",
|
|
165
|
-
"port": 51826,
|
|
166
|
-
"pin": "555-55-555"
|
|
167
|
-
},
|
|
168
|
-
"accessories": [
|
|
169
|
-
{
|
|
170
|
-
"accessory": "Cmd4",
|
|
171
|
-
"type": "Switch",
|
|
172
|
-
"outputConstants": false,
|
|
173
|
-
"displayName": "My_Switch",
|
|
174
|
-
"name": "My_Switch",
|
|
175
|
-
"on": "FALSE",
|
|
176
|
-
"manufacturer": "Custom Manufacturer",
|
|
177
|
-
"model": "Custom Model",
|
|
178
|
-
"stateChangeResponseTime": 3,
|
|
179
|
-
"state_cmd": "node .homebridge/YourScriptHere.js"
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
This configuration defines a Cmd4 Standard Accessory with the designation:
|
|
186
|
-
|
|
187
|
-
```json
|
|
188
|
-
"accessory": "Cmd4"
|
|
189
|
-
```
|
|
190
|
-
<BR>
|
|
191
|
-
Notice that there is no Platform definition. Otherwise everything is the same. You can even add linked accessories as before.<BR>
|
|
192
|
-
|
|
193
153
|
|
|
194
154
|
## Cmd4 Directives
|
|
195
155
|
|
package/index.js
CHANGED
|
@@ -38,8 +38,8 @@ module.exports =
|
|
|
38
38
|
default: function ( api )
|
|
39
39
|
{
|
|
40
40
|
// Init the libraries for all to use
|
|
41
|
-
let CMD4_CHAR_TYPE_ENUMS = CHAR_DATA.init( api.hap.
|
|
42
|
-
let CMD4_ACC_TYPE_ENUM = ACC_DATA.init( api.hap.Characteristic );
|
|
41
|
+
let CMD4_CHAR_TYPE_ENUMS = CHAR_DATA.init( api.hap.Formats, api.hap.Units, api.hap.Perms );
|
|
42
|
+
let CMD4_ACC_TYPE_ENUM = ACC_DATA.init( api.hap.Characteristic, api.hap.Formats, api.hap.Units, api.hap.Perms );
|
|
43
43
|
let CMD4_DEVICE_TYPE_ENUM = DEVICE_DATA.init(
|
|
44
44
|
CMD4_ACC_TYPE_ENUM, api.hap.Service, api.hap.Characteristic, api.hap.Categories );
|
|
45
45
|
|