@switchbot/homebridge-switchbot 3.5.1-beta.8 → 3.5.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/CHANGELOG.md +7 -0
- package/config.schema.json +19 -3
- package/dist/device/blindtilt.d.ts +6 -4
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +60 -46
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +6 -3
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +59 -25
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +6 -3
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +47 -29
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +6 -3
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +53 -36
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +6 -3
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +45 -31
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +6 -4
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +41 -27
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +6 -3
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +59 -152
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +6 -3
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +53 -32
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +6 -3
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +49 -30
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +6 -3
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +47 -28
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +6 -3
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +44 -27
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +6 -3
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +46 -28
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +6 -3
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +38 -25
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +6 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +43 -27
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +6 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +42 -27
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +6 -3
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +37 -24
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +6 -3
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +30 -17
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +6 -3
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +37 -22
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +6 -3
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +44 -25
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +2 -2
- package/dist/irdevice/airconditioner.d.ts +1 -3
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +67 -177
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +0 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +24 -53
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +12 -17
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +22 -38
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +22 -10
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +94 -100
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +20 -38
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +79 -77
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +38 -53
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +11 -16
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +11 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +4 -6
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +564 -665
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +10 -8
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +2 -1
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/devicestatus.d.ts +1 -1
- package/dist/types/devicestatus.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/device/blindtilt.ts +64 -48
- package/src/device/bot.ts +79 -26
- package/src/device/ceilinglight.ts +57 -31
- package/src/device/colorbulb.ts +57 -43
- package/src/device/contact.ts +49 -31
- package/src/device/curtain.ts +51 -28
- package/src/device/device.ts +61 -135
- package/src/device/fan.ts +67 -33
- package/src/device/hub.ts +62 -33
- package/src/device/humidifier.ts +60 -33
- package/src/device/iosensor.ts +51 -30
- package/src/device/lightstrip.ts +52 -29
- package/src/device/lock.ts +55 -26
- package/src/device/meter.ts +60 -29
- package/src/device/meterplus.ts +56 -29
- package/src/device/motion.ts +50 -26
- package/src/device/plug.ts +38 -18
- package/src/device/robotvacuumcleaner.ts +53 -24
- package/src/device/waterdetector.ts +63 -27
- package/src/homebridge-ui/public/index.html +2 -2
- package/src/irdevice/airconditioner.ts +76 -165
- package/src/irdevice/airpurifier.ts +29 -49
- package/src/irdevice/camera.ts +13 -16
- package/src/irdevice/fan.ts +25 -35
- package/src/irdevice/irdevice.ts +97 -96
- package/src/irdevice/light.ts +21 -35
- package/src/irdevice/other.ts +79 -77
- package/src/irdevice/tv.ts +40 -51
- package/src/irdevice/vacuumcleaner.ts +12 -15
- package/src/irdevice/waterheater.ts +12 -15
- package/src/platform.ts +566 -696
- package/src/settings.ts +11 -8
- package/src/types/bledevicestatus.ts +4 -2
- package/src/types/devicestatus.ts +1 -1
- package/.github/npm-version-script.cjs +0 -81
package/src/irdevice/tv.ts
CHANGED
|
@@ -59,20 +59,20 @@ export class TV extends irdeviceBase {
|
|
|
59
59
|
switch (device.remoteType) {
|
|
60
60
|
case 'Speaker':
|
|
61
61
|
case 'DIY Speaker':
|
|
62
|
-
accessory.category = this.
|
|
62
|
+
accessory.category = this.hap.Categories.SPEAKER;
|
|
63
63
|
break;
|
|
64
64
|
case 'IPTV':
|
|
65
65
|
case 'DIY IPTV':
|
|
66
|
-
accessory.category = this.
|
|
66
|
+
accessory.category = this.hap.Categories.TV_STREAMING_STICK;
|
|
67
67
|
break;
|
|
68
68
|
case 'DVD':
|
|
69
69
|
case 'DIY DVD':
|
|
70
70
|
case 'Set Top Box':
|
|
71
71
|
case 'DIY Set Top Box':
|
|
72
|
-
accessory.category = this.
|
|
72
|
+
accessory.category = this.hap.Categories.TV_SET_TOP_BOX;
|
|
73
73
|
break;
|
|
74
74
|
default:
|
|
75
|
-
accessory.category = this.
|
|
75
|
+
accessory.category = this.hap.Categories.TELEVISION;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
this.Television.Service
|
|
@@ -125,7 +125,7 @@ export class TV extends irdeviceBase {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
|
|
128
|
-
this.debugLog(
|
|
128
|
+
await this.debugLog(`VolumeSelector: ${value}`);
|
|
129
129
|
if (value === this.hap.Characteristic.VolumeSelector.INCREMENT) {
|
|
130
130
|
this.pushVolumeUpChanges();
|
|
131
131
|
} else {
|
|
@@ -136,61 +136,61 @@ export class TV extends irdeviceBase {
|
|
|
136
136
|
async RemoteKeySet(value: CharacteristicValue): Promise<void> {
|
|
137
137
|
switch (value) {
|
|
138
138
|
case this.hap.Characteristic.RemoteKey.REWIND: {
|
|
139
|
-
this.debugLog(
|
|
139
|
+
await this.debugLog('Set Remote Key Pressed: REWIND');
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
142
|
case this.hap.Characteristic.RemoteKey.FAST_FORWARD: {
|
|
143
|
-
this.debugLog(
|
|
143
|
+
await this.debugLog('Set Remote Key Pressed: FAST_FORWARD');
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
146
|
case this.hap.Characteristic.RemoteKey.NEXT_TRACK: {
|
|
147
|
-
this.debugLog(
|
|
147
|
+
await this.debugLog('Set Remote Key Pressed: NEXT_TRACK');
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
case this.hap.Characteristic.RemoteKey.PREVIOUS_TRACK: {
|
|
151
|
-
this.debugLog(
|
|
151
|
+
await this.debugLog('Set Remote Key Pressed: PREVIOUS_TRACK');
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
case this.hap.Characteristic.RemoteKey.ARROW_UP: {
|
|
155
|
-
this.debugLog(
|
|
155
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_UP');
|
|
156
156
|
//this.pushUpChanges();
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case this.hap.Characteristic.RemoteKey.ARROW_DOWN: {
|
|
160
|
-
this.debugLog(
|
|
160
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_DOWN');
|
|
161
161
|
//this.pushDownChanges();
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
case this.hap.Characteristic.RemoteKey.ARROW_LEFT: {
|
|
165
|
-
this.debugLog(
|
|
165
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_LEFT');
|
|
166
166
|
//this.pushLeftChanges();
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
case this.hap.Characteristic.RemoteKey.ARROW_RIGHT: {
|
|
170
|
-
this.debugLog(
|
|
170
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_RIGHT');
|
|
171
171
|
//this.pushRightChanges();
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
case this.hap.Characteristic.RemoteKey.SELECT: {
|
|
175
|
-
this.debugLog(
|
|
175
|
+
await this.debugLog('Set Remote Key Pressed: SELECT');
|
|
176
176
|
//this.pushOkChanges();
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
case this.hap.Characteristic.RemoteKey.BACK: {
|
|
180
|
-
this.debugLog(
|
|
180
|
+
await this.debugLog('Set Remote Key Pressed: BACK');
|
|
181
181
|
//this.pushBackChanges();
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case this.hap.Characteristic.RemoteKey.EXIT: {
|
|
185
|
-
this.debugLog(
|
|
185
|
+
await this.debugLog('Set Remote Key Pressed: EXIT');
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case this.hap.Characteristic.RemoteKey.PLAY_PAUSE: {
|
|
189
|
-
this.debugLog(
|
|
189
|
+
await this.debugLog('Set Remote Key Pressed: PLAY_PAUSE');
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
case this.hap.Characteristic.RemoteKey.INFORMATION: {
|
|
193
|
-
this.debugLog(
|
|
193
|
+
await this.debugLog('Set Remote Key Pressed: INFORMATION');
|
|
194
194
|
//this.pushMenuChanges();
|
|
195
195
|
break;
|
|
196
196
|
}
|
|
@@ -198,12 +198,12 @@ export class TV extends irdeviceBase {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
|
|
201
|
-
this.debugLog(
|
|
201
|
+
await this.debugLog(`ActiveIdentifier: ${value}`);
|
|
202
202
|
this.Television.ActiveIdentifier = value;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
206
|
-
this.debugLog(
|
|
206
|
+
await this.debugLog(`Active (value): ${value}`);
|
|
207
207
|
|
|
208
208
|
this.Television.Active = value;
|
|
209
209
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -224,7 +224,7 @@ export class TV extends irdeviceBase {
|
|
|
224
224
|
* TV "command" "channelSub" "default" previous channel
|
|
225
225
|
*/
|
|
226
226
|
async pushTvOnChanges(): Promise<void> {
|
|
227
|
-
this.debugLog(
|
|
227
|
+
await this.debugLog('pushTvOnChanges'
|
|
228
228
|
+ ` Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`);
|
|
229
229
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
230
230
|
const commandType: string = await this.commandType();
|
|
@@ -239,7 +239,7 @@ export class TV extends irdeviceBase {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
async pushTvOffChanges(): Promise<void> {
|
|
242
|
-
this.debugLog(
|
|
242
|
+
await this.debugLog('pushTvOffChanges'
|
|
243
243
|
+ ` Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`);
|
|
244
244
|
if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
245
245
|
const commandType: string = await this.commandType();
|
|
@@ -254,7 +254,7 @@ export class TV extends irdeviceBase {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
async pushOkChanges(): Promise<void> {
|
|
257
|
-
this.debugLog(
|
|
257
|
+
await this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
258
258
|
if (!this.disablePushDetail) {
|
|
259
259
|
const bodyChange = JSON.stringify({
|
|
260
260
|
command: 'Ok',
|
|
@@ -266,7 +266,7 @@ export class TV extends irdeviceBase {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
async pushBackChanges(): Promise<void> {
|
|
269
|
-
this.debugLog(
|
|
269
|
+
await this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
270
270
|
if (!this.disablePushDetail) {
|
|
271
271
|
const bodyChange = JSON.stringify({
|
|
272
272
|
command: 'Back',
|
|
@@ -278,7 +278,7 @@ export class TV extends irdeviceBase {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
async pushMenuChanges(): Promise<void> {
|
|
281
|
-
this.debugLog(
|
|
281
|
+
await this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
282
282
|
if (!this.disablePushDetail) {
|
|
283
283
|
const bodyChange = JSON.stringify({
|
|
284
284
|
command: 'Menu',
|
|
@@ -290,7 +290,7 @@ export class TV extends irdeviceBase {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
async pushUpChanges(): Promise<void> {
|
|
293
|
-
this.debugLog(
|
|
293
|
+
await this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
294
294
|
if (!this.disablePushDetail) {
|
|
295
295
|
const bodyChange = JSON.stringify({
|
|
296
296
|
command: 'Up',
|
|
@@ -302,7 +302,7 @@ export class TV extends irdeviceBase {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
async pushDownChanges(): Promise<void> {
|
|
305
|
-
this.debugLog(
|
|
305
|
+
await this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
306
306
|
if (!this.disablePushDetail) {
|
|
307
307
|
const bodyChange = JSON.stringify({
|
|
308
308
|
command: 'Down',
|
|
@@ -314,7 +314,7 @@ export class TV extends irdeviceBase {
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
async pushRightChanges(): Promise<void> {
|
|
317
|
-
this.debugLog(
|
|
317
|
+
await this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
318
318
|
if (!this.disablePushDetail) {
|
|
319
319
|
const bodyChange = JSON.stringify({
|
|
320
320
|
command: 'Right',
|
|
@@ -326,7 +326,7 @@ export class TV extends irdeviceBase {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
async pushLeftChanges(): Promise<void> {
|
|
329
|
-
this.debugLog(
|
|
329
|
+
await this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
330
330
|
if (!this.disablePushDetail) {
|
|
331
331
|
const bodyChange = JSON.stringify({
|
|
332
332
|
command: 'Left',
|
|
@@ -338,7 +338,7 @@ export class TV extends irdeviceBase {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
async pushVolumeUpChanges(): Promise<void> {
|
|
341
|
-
this.debugLog(
|
|
341
|
+
await this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
342
342
|
if (!this.disablePushDetail) {
|
|
343
343
|
const bodyChange = JSON.stringify({
|
|
344
344
|
command: 'volumeAdd',
|
|
@@ -350,7 +350,7 @@ export class TV extends irdeviceBase {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
async pushVolumeDownChanges(): Promise<void> {
|
|
353
|
-
this.debugLog(
|
|
353
|
+
await this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
354
354
|
if (!this.disablePushDetail) {
|
|
355
355
|
const bodyChange = JSON.stringify({
|
|
356
356
|
command: 'volumeSub',
|
|
@@ -362,14 +362,14 @@ export class TV extends irdeviceBase {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
async pushTVChanges(bodyChange: any): Promise<void> {
|
|
365
|
-
this.debugLog(
|
|
365
|
+
await this.debugLog('pushTVChanges');
|
|
366
366
|
if (this.device.connectionType === 'OpenAPI') {
|
|
367
|
-
this.infoLog(
|
|
367
|
+
await this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
368
368
|
try {
|
|
369
369
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
370
370
|
const deviceStatus: any = await body.json();
|
|
371
371
|
await this.pushStatusCodes(statusCode, deviceStatus);
|
|
372
|
-
if (
|
|
372
|
+
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
373
373
|
await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
|
|
374
374
|
await this.updateHomeKitCharacteristics();
|
|
375
375
|
} else {
|
|
@@ -381,29 +381,18 @@ export class TV extends irdeviceBase {
|
|
|
381
381
|
await this.pushChangeError(e);
|
|
382
382
|
}
|
|
383
383
|
} else {
|
|
384
|
-
this.warnLog(
|
|
385
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
384
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
386
385
|
}
|
|
387
386
|
}
|
|
388
387
|
|
|
389
388
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
389
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
390
390
|
// Active
|
|
391
|
-
|
|
392
|
-
this.
|
|
393
|
-
} else {
|
|
394
|
-
this.accessory.context.Active = this.Television.Active;
|
|
395
|
-
this.Television.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Television.Active);
|
|
396
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Television.Active}`);
|
|
397
|
-
}
|
|
391
|
+
await this.updateCharacteristic(this.Television.Service, this.hap.Characteristic.Active,
|
|
392
|
+
this.Television.Active, 'Active');
|
|
398
393
|
// ActiveIdentifier
|
|
399
|
-
|
|
400
|
-
this.
|
|
401
|
-
} else {
|
|
402
|
-
this.accessory.context.ActiveIdentifier = this.Television.ActiveIdentifier;
|
|
403
|
-
this.Television.Service.updateCharacteristic(this.hap.Characteristic.ActiveIdentifier, this.Television.ActiveIdentifier);
|
|
404
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
405
|
-
+ ` ActiveIdentifier: ${this.Television.ActiveIdentifier}`);
|
|
406
|
-
}
|
|
394
|
+
await this.updateCharacteristic(this.Television.Service, this.hap.Characteristic.ActiveIdentifier,
|
|
395
|
+
this.Television.ActiveIdentifier, 'ActiveIdentifier');
|
|
407
396
|
}
|
|
408
397
|
|
|
409
398
|
async apiError(e: any): Promise<void> {
|
|
@@ -28,6 +28,8 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
28
28
|
device: irdevice & irDevicesConfig,
|
|
29
29
|
) {
|
|
30
30
|
super(platform, accessory, device);
|
|
31
|
+
// Set category
|
|
32
|
+
accessory.category = this.hap.Categories.OTHER;
|
|
31
33
|
|
|
32
34
|
// Initialize Switch Service
|
|
33
35
|
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
@@ -48,7 +50,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
51
|
-
this.debugLog(
|
|
53
|
+
await this.debugLog(`On: ${value}`);
|
|
52
54
|
|
|
53
55
|
// Set the requested state
|
|
54
56
|
this.Switch.On = value;
|
|
@@ -66,7 +68,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
66
68
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
67
69
|
*/
|
|
68
70
|
async pushOnChanges(): Promise<void> {
|
|
69
|
-
this.debugLog(
|
|
71
|
+
await this.debugLog('pushOnChanges'
|
|
70
72
|
+ ` On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`);
|
|
71
73
|
if (this.Switch.On && !this.disablePushOn) {
|
|
72
74
|
const commandType: string = await this.commandType();
|
|
@@ -81,7 +83,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
async pushOffChanges(): Promise<void> {
|
|
84
|
-
this.debugLog(
|
|
86
|
+
await this.debugLog('pushOffChanges'
|
|
85
87
|
+ ` On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`);
|
|
86
88
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
87
89
|
const commandType: string = await this.commandType();
|
|
@@ -96,14 +98,14 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
99
|
-
this.debugLog(
|
|
101
|
+
await this.debugLog('pushChanges');
|
|
100
102
|
if (this.device.connectionType === 'OpenAPI') {
|
|
101
|
-
this.infoLog(
|
|
103
|
+
await this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
102
104
|
try {
|
|
103
105
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
104
106
|
const deviceStatus: any = await body.json();
|
|
105
107
|
await this.pushStatusCodes(statusCode, deviceStatus);
|
|
106
|
-
if (
|
|
108
|
+
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
107
109
|
await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
|
|
108
110
|
await this.updateHomeKitCharacteristics();
|
|
109
111
|
} else {
|
|
@@ -115,20 +117,15 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
115
117
|
await this.pushChangeError(e);
|
|
116
118
|
}
|
|
117
119
|
} else {
|
|
118
|
-
this.warnLog(
|
|
119
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
120
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
125
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
124
126
|
// On
|
|
125
|
-
|
|
126
|
-
this.
|
|
127
|
-
} else {
|
|
128
|
-
this.accessory.context.On = this.Switch.On;
|
|
129
|
-
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
130
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch.On}`);
|
|
131
|
-
}
|
|
127
|
+
await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On,
|
|
128
|
+
this.Switch.On, 'On');
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
async apiError(e: any): Promise<void> {
|
|
@@ -28,6 +28,8 @@ export class WaterHeater extends irdeviceBase {
|
|
|
28
28
|
device: irdevice & irDevicesConfig,
|
|
29
29
|
) {
|
|
30
30
|
super(platform, accessory, device);
|
|
31
|
+
// Set category
|
|
32
|
+
accessory.category = this.hap.Categories.FAUCET;
|
|
31
33
|
|
|
32
34
|
// Initialize Switch Service
|
|
33
35
|
accessory.context.Valve = accessory.context.Valve ?? {};
|
|
@@ -49,7 +51,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
52
|
-
this.debugLog(
|
|
54
|
+
await this.debugLog(`Active: ${value}`);
|
|
53
55
|
|
|
54
56
|
this.Valve.Active = value;
|
|
55
57
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -68,7 +70,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
68
70
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
69
71
|
*/
|
|
70
72
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
71
|
-
this.debugLog(
|
|
73
|
+
await this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active},`
|
|
72
74
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
73
75
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
74
76
|
const commandType: string = await this.commandType();
|
|
@@ -83,7 +85,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
86
|
-
this.debugLog(
|
|
88
|
+
await this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active},`
|
|
87
89
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
88
90
|
if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
89
91
|
const commandType: string = await this.commandType();
|
|
@@ -98,14 +100,14 @@ export class WaterHeater extends irdeviceBase {
|
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
101
|
-
this.debugLog(
|
|
103
|
+
await this.debugLog('pushChanges');
|
|
102
104
|
if (this.device.connectionType === 'OpenAPI') {
|
|
103
|
-
this.infoLog(
|
|
105
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
104
106
|
try {
|
|
105
107
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
106
108
|
const deviceStatus: any = await body.json();
|
|
107
109
|
await this.pushStatusCodes(statusCode, deviceStatus);
|
|
108
|
-
if (
|
|
110
|
+
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
109
111
|
await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
|
|
110
112
|
await this.updateHomeKitCharacteristics();
|
|
111
113
|
} else {
|
|
@@ -117,20 +119,15 @@ export class WaterHeater extends irdeviceBase {
|
|
|
117
119
|
await this.pushChangeError(e);
|
|
118
120
|
}
|
|
119
121
|
} else {
|
|
120
|
-
this.warnLog(
|
|
121
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
122
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
127
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
126
128
|
// Active
|
|
127
|
-
|
|
128
|
-
this.
|
|
129
|
-
} else {
|
|
130
|
-
this.accessory.context.Active = this.Valve.Active;
|
|
131
|
-
this.Valve.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Valve.Active);
|
|
132
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Valve.Active}`);
|
|
133
|
-
}
|
|
129
|
+
await this.updateCharacteristic(this.Valve.Service, this.hap.Characteristic.Active,
|
|
130
|
+
this.Valve.Active, 'Active');
|
|
134
131
|
}
|
|
135
132
|
|
|
136
133
|
async apiError({ e }: { e: any }): Promise<void> {
|