homebridge-cmd4 7.1.0 → 8.0.0-beta.1

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/Cmd4Accessory.js CHANGED
@@ -1515,8 +1515,10 @@ class Cmd4Accessory
1515
1515
 
1516
1516
  break;
1517
1517
  case constants.ACCESSORY:
1518
- // Do nothing as this is a key for homebridge, not us
1519
- break;
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
@@ -505,7 +505,14 @@ switch( io )
505
505
  {
506
506
  c = readData( device, characteristic );
507
507
 
508
- if ( c == "" ) process.stdout.write( "2" ); else process.stdout.write( `"${ c }"` );
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
  }
@@ -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
- &nbsp;&nbsp;&nbsp; Cmd4 is not possible without Homebridge. Prior to Cmd4 Version 3, Cmd4 just created Standard Plugin Accessories. With Version 3 of Cmd4, Cmd4 follows the Hombridge API as defined on [Homebridge API](https://developers.homebridge.io/#/) to be followed exactly. Both Platform and Accessory Plugins can be created. In fact the examples can be recreated exactly.<BR>
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
+ &nbsp;&nbsp;&nbsp; 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
- &nbsp;&nbsp;&nbsp; The best way to explain the difference is to understand how the Homebridge API defines a Television as a Platform Accessory. [Homebridge Television](https://developers.homebridge.io/#/service/Television). Cmd4 Version 3 can recreate the exact same configuration as:<as:
37
+ &nbsp;&nbsp;&nbsp; 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
- &nbsp;&nbsp;&nbsp;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.Characteristic );
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