@switchbot/homebridge-switchbot 2.0.0-beta.18 → 2.0.0-beta.19

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/config.schema.json +11 -2
  3. package/dist/device/bot.d.ts +2 -0
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +201 -163
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts +2 -0
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +250 -218
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.d.ts +2 -0
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +85 -66
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts +2 -0
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +166 -136
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/humidifier.d.ts.map +1 -1
  20. package/dist/device/humidifier.js +126 -115
  21. package/dist/device/humidifier.js.map +1 -1
  22. package/dist/device/lock.d.ts +2 -0
  23. package/dist/device/lock.d.ts.map +1 -1
  24. package/dist/device/lock.js +156 -130
  25. package/dist/device/lock.js.map +1 -1
  26. package/dist/device/meter.d.ts +2 -0
  27. package/dist/device/meter.d.ts.map +1 -1
  28. package/dist/device/meter.js +85 -64
  29. package/dist/device/meter.js.map +1 -1
  30. package/dist/device/meterplus.d.ts +2 -0
  31. package/dist/device/meterplus.d.ts.map +1 -1
  32. package/dist/device/meterplus.js +78 -59
  33. package/dist/device/meterplus.js.map +1 -1
  34. package/dist/device/motion.d.ts +2 -0
  35. package/dist/device/motion.d.ts.map +1 -1
  36. package/dist/device/motion.js +76 -57
  37. package/dist/device/motion.js.map +1 -1
  38. package/dist/device/plug.d.ts +2 -0
  39. package/dist/device/plug.d.ts.map +1 -1
  40. package/dist/device/plug.js +133 -107
  41. package/dist/device/plug.js.map +1 -1
  42. package/dist/device/striplight.d.ts +2 -0
  43. package/dist/device/striplight.d.ts.map +1 -1
  44. package/dist/device/striplight.js +224 -195
  45. package/dist/device/striplight.js.map +1 -1
  46. package/dist/irdevice/airconditioner.d.ts +2 -0
  47. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  48. package/dist/irdevice/airconditioner.js +127 -105
  49. package/dist/irdevice/airconditioner.js.map +1 -1
  50. package/dist/irdevice/airpurifier.d.ts +2 -0
  51. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  52. package/dist/irdevice/airpurifier.js +83 -66
  53. package/dist/irdevice/airpurifier.js.map +1 -1
  54. package/dist/irdevice/camera.d.ts +8 -6
  55. package/dist/irdevice/camera.d.ts.map +1 -1
  56. package/dist/irdevice/camera.js +83 -68
  57. package/dist/irdevice/camera.js.map +1 -1
  58. package/dist/irdevice/fan.d.ts +7 -5
  59. package/dist/irdevice/fan.d.ts.map +1 -1
  60. package/dist/irdevice/fan.js +90 -75
  61. package/dist/irdevice/fan.js.map +1 -1
  62. package/dist/irdevice/light.d.ts +8 -6
  63. package/dist/irdevice/light.d.ts.map +1 -1
  64. package/dist/irdevice/light.js +83 -68
  65. package/dist/irdevice/light.js.map +1 -1
  66. package/dist/irdevice/other.d.ts +8 -6
  67. package/dist/irdevice/other.d.ts.map +1 -1
  68. package/dist/irdevice/other.js +93 -78
  69. package/dist/irdevice/other.js.map +1 -1
  70. package/dist/irdevice/tv.d.ts +8 -6
  71. package/dist/irdevice/tv.d.ts.map +1 -1
  72. package/dist/irdevice/tv.js +68 -52
  73. package/dist/irdevice/tv.js.map +1 -1
  74. package/dist/irdevice/vacuumcleaner.d.ts +8 -6
  75. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  76. package/dist/irdevice/vacuumcleaner.js +83 -69
  77. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  78. package/dist/irdevice/waterheater.d.ts +2 -0
  79. package/dist/irdevice/waterheater.d.ts.map +1 -1
  80. package/dist/irdevice/waterheater.js +75 -60
  81. package/dist/irdevice/waterheater.js.map +1 -1
  82. package/dist/settings.d.ts +12 -11
  83. package/dist/settings.d.ts.map +1 -1
  84. package/dist/settings.js.map +1 -1
  85. package/package.json +1 -1
  86. package/src/device/bot.ts +200 -163
  87. package/src/device/colorbulb.ts +252 -221
  88. package/src/device/contact.ts +85 -66
  89. package/src/device/curtain.ts +165 -136
  90. package/src/device/humidifier.ts +126 -115
  91. package/src/device/lock.ts +156 -131
  92. package/src/device/meter.ts +85 -64
  93. package/src/device/meterplus.ts +78 -59
  94. package/src/device/motion.ts +76 -57
  95. package/src/device/plug.ts +132 -107
  96. package/src/device/striplight.ts +226 -198
  97. package/src/irdevice/airconditioner.ts +126 -103
  98. package/src/irdevice/airpurifier.ts +84 -66
  99. package/src/irdevice/camera.ts +84 -68
  100. package/src/irdevice/fan.ts +91 -75
  101. package/src/irdevice/light.ts +84 -68
  102. package/src/irdevice/other.ts +94 -78
  103. package/src/irdevice/tv.ts +69 -53
  104. package/src/irdevice/vacuumcleaner.ts +83 -68
  105. package/src/irdevice/waterheater.ts +76 -60
  106. package/src/settings.ts +12 -11
@@ -61,7 +61,7 @@ class Light {
61
61
  });*/
62
62
  }
63
63
  async OnSet(value) {
64
- this.debugLog(`Light: ${this.accessory.displayName} On: ${value}`);
64
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
65
65
  this.On = value;
66
66
  if (this.On) {
67
67
  await this.pushLightOnChanges();
@@ -72,22 +72,22 @@ class Light {
72
72
  }
73
73
  async updateHomeKitCharacteristics() {
74
74
  if (this.On === undefined) {
75
- this.debugLog(`Light: ${this.accessory.displayName} On: ${this.On}`);
75
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
76
76
  }
77
77
  else {
78
78
  this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
79
- this.debugLog(`Light: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
79
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
80
80
  }
81
81
  }
82
82
  /**
83
83
  * Pushes the requested changes to the SwitchBot API
84
84
  * deviceType commandType Command command parameter Description
85
- * Light: "command" "turnOff" "default" = set to OFF state
86
- * Light: "command" "turnOn" "default" = set to ON state
87
- * Light: "command" "volumeAdd" "default" = volume up
88
- * Light: "command" "volumeSub" "default" = volume down
89
- * Light: "command" "channelAdd" "default" = next channel
90
- * Light: "command" "channelSub" "default" = previous channel
85
+ * Light - "command" "turnOff" "default" = set to OFF state
86
+ * Light - "command" "turnOn" "default" = set to ON state
87
+ * Light - "command" "volumeAdd" "default" = volume up
88
+ * Light - "command" "volumeSub" "default" = volume down
89
+ * Light - "command" "channelAdd" "default" = next channel
90
+ * Light - "command" "channelSub" "default" = previous channel
91
91
  */
92
92
  async pushLightOnChanges() {
93
93
  if (this.On) {
@@ -126,88 +126,100 @@ class Light {
126
126
  await this.pushChanges(body);
127
127
  }
128
128
  async pushChanges(body) {
129
- try {
130
- // Make Push On request to the API
131
- const t = Date.now();
132
- const nonce = 'requestID';
133
- const data = this.platform.config.credentials?.token + t + nonce;
134
- const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
135
- .update(Buffer.from(data, 'utf-8'))
136
- .digest();
137
- const sign = signTerm.toString('base64');
138
- this.debugLog(`Light: ${this.accessory.displayName} sign: ${sign}`);
139
- this.infoLog(`Light: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
140
- const options = {
141
- hostname: settings_1.HostDomain,
142
- port: 443,
143
- path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
144
- method: 'POST',
145
- headers: {
146
- 'Authorization': this.platform.config.credentials?.token,
147
- 'sign': sign,
148
- 'nonce': nonce,
149
- 't': t,
150
- 'Content-Type': 'application/json',
151
- 'Content-Length': body.length,
152
- },
153
- };
154
- const req = https_1.default.request(options, res => {
155
- this.debugLog(`Light: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
156
- this.statusCode({ res });
157
- res.on('data', d => {
158
- this.debugLog(`Light: ${this.accessory.displayName} d: ${d}`);
129
+ if (this.OpenAPI) {
130
+ try {
131
+ // Make Push On request to the API
132
+ const t = Date.now();
133
+ const nonce = 'requestID';
134
+ const data = this.platform.config.credentials?.token + t + nonce;
135
+ const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
136
+ .update(Buffer.from(data, 'utf-8'))
137
+ .digest();
138
+ const sign = signTerm.toString('base64');
139
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
140
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
141
+ const options = {
142
+ hostname: settings_1.HostDomain,
143
+ port: 443,
144
+ path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
145
+ method: 'POST',
146
+ headers: {
147
+ 'Authorization': this.platform.config.credentials?.token,
148
+ 'sign': sign,
149
+ 'nonce': nonce,
150
+ 't': t,
151
+ 'Content-Type': 'application/json',
152
+ 'Content-Length': body.length,
153
+ },
154
+ };
155
+ const req = https_1.default.request(options, res => {
156
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
157
+ this.statusCode({ res });
158
+ res.on('data', d => {
159
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
160
+ });
159
161
  });
160
- });
161
- req.on('error', (e) => {
162
- this.errorLog(`Light: ${this.accessory.displayName} error message: ${e.message}`);
163
- });
164
- req.write(body);
165
- req.end();
166
- this.debugLog(`Light: ${this.accessory.displayName} pushchanges: ${(0, super_stringify_1.default)(req)}`);
167
- this.OnCached = this.On;
168
- this.accessory.context.On = this.OnCached;
169
- this.updateHomeKitCharacteristics();
170
- }
171
- catch (e) {
172
- this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
173
- if (this.deviceLogging.includes('debug')) {
174
- this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
162
+ req.on('error', (e) => {
163
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
164
+ });
165
+ req.write(body);
166
+ req.end();
167
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${(0, super_stringify_1.default)(req)}`);
168
+ this.OnCached = this.On;
169
+ this.accessory.context.On = this.OnCached;
170
+ this.updateHomeKitCharacteristics();
171
+ }
172
+ catch (e) {
173
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
174
+ if (this.deviceLogging.includes('debug')) {
175
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
176
+ + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
177
+ }
178
+ this.apiError(e);
175
179
  }
176
- this.apiError(e);
177
180
  }
178
181
  }
179
182
  async statusCode({ res }) {
180
183
  switch (res.statusCode) {
181
184
  case 151:
182
- this.errorLog(`Light: ${this.accessory.displayName} Command not supported by this device type.`);
185
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this device type.`);
183
186
  break;
184
187
  case 152:
185
- this.errorLog(`Light: ${this.accessory.displayName} Device not found.`);
188
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found.`);
186
189
  break;
187
190
  case 160:
188
- this.errorLog(`Light: ${this.accessory.displayName} Command is not supported.`);
191
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported.`);
189
192
  break;
190
193
  case 161:
191
- this.errorLog(`Light: ${this.accessory.displayName} Device is offline.`);
194
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline.`);
192
195
  break;
193
196
  case 171:
194
- this.errorLog(`Light: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
197
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
195
198
  break;
196
199
  case 190:
197
- this.errorLog(`Light: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
200
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
198
201
  ` with server, Or command: ${(0, super_stringify_1.default)(res)} format is invalid`);
199
202
  break;
200
203
  case 100:
201
- this.debugLog(`Light: ${this.accessory.displayName} Command successfully sent.`);
204
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent.`);
202
205
  break;
203
206
  default:
204
- this.debugLog(`Light: ${this.accessory.displayName} Unknown statusCode.`);
207
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode.`);
205
208
  }
206
209
  }
207
210
  async apiError(e) {
208
211
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
209
212
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
210
213
  }
214
+ async openAPI() {
215
+ if (!this.device.openAPI) {
216
+ this.OpenAPI = true;
217
+ }
218
+ else {
219
+ this.OpenAPI = this.device.openAPI;
220
+ }
221
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using OpenAPI: ${this.OpenAPI}`);
222
+ }
211
223
  async config(device) {
212
224
  let config = {};
213
225
  if (device.irlight) {
@@ -216,26 +228,29 @@ class Light {
216
228
  if (device.logging !== undefined) {
217
229
  config['logging'] = device.logging;
218
230
  }
231
+ if (device.openAPI !== undefined) {
232
+ config['openAPI'] = device.openAPI;
233
+ }
219
234
  if (Object.entries(config).length !== 0) {
220
- this.infoLog(`Light: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
235
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
221
236
  }
222
237
  }
223
238
  async logs(device) {
224
239
  if (this.platform.debugMode) {
225
240
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
226
- this.debugLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
241
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
227
242
  }
228
243
  else if (device.logging) {
229
244
  this.deviceLogging = this.accessory.context.logging = device.logging;
230
- this.debugLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
245
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
231
246
  }
232
247
  else if (this.platform.config.options?.logging) {
233
248
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
234
- this.debugLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
249
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
235
250
  }
236
251
  else {
237
252
  this.deviceLogging = this.accessory.context.logging = 'standard';
238
- this.debugLog(`Light: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
253
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
239
254
  }
240
255
  }
241
256
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"light.js","sourceRoot":"","sources":["../../src/irdevice/light.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,oDAA4B;AAE5B,sEAA6C;AAE7C,0CAAgF;AAGhF;;;;GAIG;AACH,MAAa,KAAK;IAWhB,YAA6B,QAA2B,EAAU,SAA4B,EAAS,MAAkC;QAA5G,aAAQ,GAAR,QAAQ,CAAmB;QAAU,cAAS,GAAT,SAAS,CAAmB;QAAS,WAAM,GAAN,MAAM,CAA4B;QACvI,uBAAuB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,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AAG,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IACnF,CAAC;CACF;AAzSD,sBAySC"}
@@ -17,18 +17,19 @@ export declare class Others {
17
17
  ActiveCached: CharacteristicValue;
18
18
  deviceLogging: string;
19
19
  otherDeviceType?: string;
20
+ OpenAPI?: boolean;
20
21
  constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: irdevice & irDevicesConfig);
21
22
  ActiveSet(value: CharacteristicValue): Promise<void>;
22
23
  updateHomeKitCharacteristics(): Promise<void>;
23
24
  /**
24
25
  * Pushes the requested changes to the SwitchBot API
25
26
  * deviceType commandType Command command parameter Description
26
- * Light: "command" "turnOff" "default" = set to OFF state
27
- * Light: "command" "turnOn" "default" = set to ON state
28
- * Light: "command" "volumeAdd" "default" = volume up
29
- * Light: "command" "volumeSub" "default" = volume down
30
- * Light: "command" "channelAdd" "default" = next channel
31
- * Light: "command" "channelSub" "default" = previous channel
27
+ * Other - "command" "turnOff" "default" = set to OFF state
28
+ * Other - "command" "turnOn" "default" = set to ON state
29
+ * Other - "command" "volumeAdd" "default" = volume up
30
+ * Other - "command" "volumeSub" "default" = volume down
31
+ * Other - "command" "channelAdd" "default" = next channel
32
+ * Other - "command" "channelSub" "default" = previous channel
32
33
  */
33
34
  pushOnChanges(): Promise<void>;
34
35
  pushOffChanges(): Promise<void>;
@@ -38,6 +39,7 @@ export declare class Others {
38
39
  }): Promise<void>;
39
40
  apiError(e: any): Promise<void>;
40
41
  deviceType(device: irdevice & irDevicesConfig): Promise<void>;
42
+ openAPI(): Promise<void>;
41
43
  config(device: irdevice & irDevicesConfig): Promise<void>;
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,EAAU,SAAS,EAAE,iBAAiB,EAAS,MAAM,EAAE,QAAQ,GAAG,eAAe;IAyCnI,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpD,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IASnD;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB9B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB/B,WAAW,CAAC,IAAI,KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDhC,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B5D,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/B,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7D,OAAO;IASP,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB7D;;OAEG;IACH,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAU7B,qBAAqB,IAAI,OAAO;CAGjC"}
@@ -37,26 +37,26 @@ class Others {
37
37
  // get the Television service if it exists, otherwise create a new Television service
38
38
  // you can create multiple services for each accessory
39
39
  if (this.otherDeviceType !== 'Fan') {
40
- this.debugLog(`Other: ${accessory.displayName} Removing Fanv2 Service`);
40
+ this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Removing Fanv2 Service`);
41
41
  if (this.otherDeviceType === undefined) {
42
- this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${device.other?.deviceType}`);
42
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} No Device Type Set, deviceType: ${device.other?.deviceType}`);
43
43
  }
44
44
  this.fanService = this.accessory.getService(this.platform.Service.Fanv2);
45
45
  accessory.removeService(this.fanService);
46
46
  }
47
47
  else if (!this.fanService && this.otherDeviceType === 'Fan') {
48
- this.debugLog(`Other: ${accessory.displayName} Add Fanv2 Service`);
48
+ this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Add Fanv2 Service`);
49
49
  (this.fanService = this.accessory.getService(this.platform.Service.Fanv2) || this.accessory.addService(this.platform.Service.Fanv2)),
50
50
  `${accessory.displayName} Fan`;
51
51
  this.fanService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Fan`);
52
52
  this.fanService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
53
53
  }
54
54
  else {
55
- this.debugLog(`Other: ${accessory.displayName} Fanv2 Service Not Added, deviceType: ${device.other?.deviceType}`);
55
+ this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Fanv2 Service Not Added, deviceType: ${device.other?.deviceType}`);
56
56
  }
57
57
  }
58
58
  async ActiveSet(value) {
59
- this.debugLog(`Other: ${this.accessory.displayName} On: ${value}`);
59
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
60
60
  if (value) {
61
61
  await this.pushOnChanges();
62
62
  }
@@ -69,22 +69,22 @@ class Others {
69
69
  }
70
70
  async updateHomeKitCharacteristics() {
71
71
  if (this.Active === undefined) {
72
- this.debugLog(`Other: ${this.accessory.displayName} Active: ${this.Active}`);
72
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
73
73
  }
74
74
  else {
75
75
  this.fanService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
76
- this.debugLog(`Other: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
76
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
77
77
  }
78
78
  }
79
79
  /**
80
80
  * Pushes the requested changes to the SwitchBot API
81
81
  * deviceType commandType Command command parameter Description
82
- * Light: "command" "turnOff" "default" = set to OFF state
83
- * Light: "command" "turnOn" "default" = set to ON state
84
- * Light: "command" "volumeAdd" "default" = volume up
85
- * Light: "command" "volumeSub" "default" = volume down
86
- * Light: "command" "channelAdd" "default" = next channel
87
- * Light: "command" "channelSub" "default" = previous channel
82
+ * Other - "command" "turnOff" "default" = set to OFF state
83
+ * Other - "command" "turnOn" "default" = set to ON state
84
+ * Other - "command" "volumeAdd" "default" = volume up
85
+ * Other - "command" "volumeSub" "default" = volume down
86
+ * Other - "command" "channelAdd" "default" = next channel
87
+ * Other - "command" "channelSub" "default" = previous channel
88
88
  */
89
89
  async pushOnChanges() {
90
90
  if (this.platform.config.options) {
@@ -100,15 +100,15 @@ class Others {
100
100
  }
101
101
  }
102
102
  else {
103
- this.errorLog(`Other: ${this.accessory.displayName} On Command not set, commandOn: ${this.device.other.commandOn}`);
103
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set, commandOn: ${this.device.other.commandOn}`);
104
104
  }
105
105
  }
106
106
  else {
107
- this.errorLog(`Other: ${this.accessory.displayName} On Command not set, other: ${this.device.other}`);
107
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set, other: ${this.device.other}`);
108
108
  }
109
109
  }
110
110
  else {
111
- this.errorLog(`Other: ${this.accessory.displayName} On Command not set`);
111
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set`);
112
112
  }
113
113
  }
114
114
  async pushOffChanges() {
@@ -125,92 +125,95 @@ class Others {
125
125
  }
126
126
  }
127
127
  else {
128
- this.errorLog(`Other: ${this.accessory.displayName} Off Command not set, commandOff: ${this.device.other.commandOff}`);
128
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set, commandOff: ${this.device.other.commandOff}`);
129
129
  }
130
130
  }
131
131
  else {
132
- this.errorLog(`Other: ${this.accessory.displayName} Off Command not set, other: ${this.device.other}`);
132
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set, other: ${this.device.other}`);
133
133
  }
134
134
  }
135
135
  else {
136
- this.errorLog(`Other: ${this.accessory.displayName} Off Command not set.`);
136
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set.`);
137
137
  }
138
138
  }
139
139
  async pushChanges(body) {
140
- try {
141
- // Make Push On request to the API
142
- const t = Date.now();
143
- const nonce = 'requestID';
144
- const data = this.platform.config.credentials?.token + t + nonce;
145
- const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
146
- .update(Buffer.from(data, 'utf-8'))
147
- .digest();
148
- const sign = signTerm.toString('base64');
149
- this.debugLog(`Other: ${this.accessory.displayName} sign: ${sign}`);
150
- this.infoLog(`Other: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
151
- const options = {
152
- hostname: settings_1.HostDomain,
153
- port: 443,
154
- path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
155
- method: 'POST',
156
- headers: {
157
- 'Authorization': this.platform.config.credentials?.token,
158
- 'sign': sign,
159
- 'nonce': nonce,
160
- 't': t,
161
- 'Content-Type': 'application/json',
162
- 'Content-Length': body.length,
163
- },
164
- };
165
- const req = https_1.default.request(options, res => {
166
- this.debugLog(`Other: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
167
- this.statusCode({ res });
168
- res.on('data', d => {
169
- this.debugLog(`Other: ${this.accessory.displayName} d: ${d}`);
140
+ if (this.OpenAPI) {
141
+ try {
142
+ // Make Push On request to the API
143
+ const t = Date.now();
144
+ const nonce = 'requestID';
145
+ const data = this.platform.config.credentials?.token + t + nonce;
146
+ const signTerm = crypto_1.default.createHmac('sha256', this.platform.config.credentials?.secret)
147
+ .update(Buffer.from(data, 'utf-8'))
148
+ .digest();
149
+ const sign = signTerm.toString('base64');
150
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
151
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
152
+ const options = {
153
+ hostname: settings_1.HostDomain,
154
+ port: 443,
155
+ path: `${settings_1.DevicePath}/${this.device.deviceId}/commands`,
156
+ method: 'POST',
157
+ headers: {
158
+ 'Authorization': this.platform.config.credentials?.token,
159
+ 'sign': sign,
160
+ 'nonce': nonce,
161
+ 't': t,
162
+ 'Content-Type': 'application/json',
163
+ 'Content-Length': body.length,
164
+ },
165
+ };
166
+ const req = https_1.default.request(options, res => {
167
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
168
+ this.statusCode({ res });
169
+ res.on('data', d => {
170
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
171
+ });
170
172
  });
171
- });
172
- req.on('error', (e) => {
173
- this.errorLog(`Other: ${this.accessory.displayName} error message: ${e.message}`);
174
- });
175
- req.write(body);
176
- req.end();
177
- this.debugLog(`Other: ${this.accessory.displayName} pushchanges: ${(0, super_stringify_1.default)(req)}`);
178
- this.updateHomeKitCharacteristics();
179
- }
180
- catch (e) {
181
- this.errorLog(`Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
182
- if (this.deviceLogging.includes('debug')) {
183
- this.errorLog(`Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
173
+ req.on('error', (e) => {
174
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
175
+ });
176
+ req.write(body);
177
+ req.end();
178
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${(0, super_stringify_1.default)(req)}`);
179
+ this.updateHomeKitCharacteristics();
180
+ }
181
+ catch (e) {
182
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
183
+ if (this.deviceLogging.includes('debug')) {
184
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
185
+ + ` Error Message: ${(0, super_stringify_1.default)(e.message)}`);
186
+ }
187
+ this.apiError(e);
184
188
  }
185
- this.apiError(e);
186
189
  }
187
190
  }
188
191
  async statusCode({ res }) {
189
192
  switch (res.statusCode) {
190
193
  case 151:
191
- this.errorLog(`Other: ${this.accessory.displayName} Command not supported by this device type.`);
194
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this device type.`);
192
195
  break;
193
196
  case 152:
194
- this.errorLog(`Other: ${this.accessory.displayName} Device not found.`);
197
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found.`);
195
198
  break;
196
199
  case 160:
197
- this.errorLog(`Other: ${this.accessory.displayName} Command is not supported.`);
200
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported.`);
198
201
  break;
199
202
  case 161:
200
- this.errorLog(`Other: ${this.accessory.displayName} Device is offline.`);
203
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline.`);
201
204
  break;
202
205
  case 171:
203
- this.errorLog(`Other: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
206
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
204
207
  break;
205
208
  case 190:
206
- this.errorLog(`Other: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
209
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
207
210
  ` with server, Or command: ${(0, super_stringify_1.default)(res)} format is invalid`);
208
211
  break;
209
212
  case 100:
210
- this.debugLog(`Other: ${this.accessory.displayName} Command successfully sent.`);
213
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent.`);
211
214
  break;
212
215
  default:
213
- this.debugLog(`Other: ${this.accessory.displayName} Unknown statusCode.`);
216
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode.`);
214
217
  }
215
218
  }
216
219
  async apiError(e) {
@@ -221,13 +224,22 @@ class Others {
221
224
  if (device.other?.deviceType) {
222
225
  this.otherDeviceType = this.accessory.context.deviceType = device.other.deviceType;
223
226
  if (this.deviceLogging.includes('debug') || this.deviceLogging === 'standard') {
224
- this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
227
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
225
228
  }
226
229
  }
227
230
  else {
228
- this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
231
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
229
232
  }
230
233
  }
234
+ async openAPI() {
235
+ if (!this.device.openAPI) {
236
+ this.OpenAPI = true;
237
+ }
238
+ else {
239
+ this.OpenAPI = this.device.openAPI;
240
+ }
241
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using OpenAPI: ${this.OpenAPI}`);
242
+ }
231
243
  async config(device) {
232
244
  let config = {};
233
245
  if (device.other) {
@@ -236,26 +248,29 @@ class Others {
236
248
  if (device.logging !== undefined) {
237
249
  config['logging'] = device.logging;
238
250
  }
251
+ if (device.openAPI !== undefined) {
252
+ config['openAPI'] = device.openAPI;
253
+ }
239
254
  if (Object.entries(config).length !== 0) {
240
- this.infoLog(`Other: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
255
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${(0, super_stringify_1.default)(config)}`);
241
256
  }
242
257
  }
243
258
  async logs(device) {
244
259
  if (this.platform.debugMode) {
245
260
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
246
- this.debugLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
261
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
247
262
  }
248
263
  else if (device.logging) {
249
264
  this.deviceLogging = this.accessory.context.logging = device.logging;
250
- this.debugLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
265
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
251
266
  }
252
267
  else if (this.platform.config.options?.logging) {
253
268
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
254
- this.debugLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
269
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
255
270
  }
256
271
  else {
257
272
  this.deviceLogging = this.accessory.context.logging = 'standard';
258
- this.debugLog(`Other: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
273
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
259
274
  }
260
275
  }
261
276
  /**