@switchbot/homebridge-switchbot 3.5.1-beta.1 → 3.5.1-beta.11
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/README.md +16 -0
- package/dist/device/blindtilt.d.ts +15 -6
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +203 -255
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +9 -4
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +196 -218
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +9 -4
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +203 -249
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +10 -5
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +329 -378
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +9 -4
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +99 -142
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +19 -7
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +203 -264
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +28 -32
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +186 -225
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +9 -4
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +198 -227
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +9 -5
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +106 -231
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +12 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +192 -232
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +9 -4
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +91 -157
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +10 -5
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +287 -367
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +10 -5
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +171 -216
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +9 -4
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +93 -158
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +9 -4
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +94 -155
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +9 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +84 -142
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +9 -4
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +99 -124
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +9 -6
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +170 -253
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +12 -4
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +105 -129
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +2 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +45 -51
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +2 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +17 -17
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +2 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +19 -19
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +24 -11
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +90 -68
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +2 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +15 -17
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +2 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +76 -76
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +2 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +35 -35
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +2 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +2 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +15 -15
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +288 -271
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +49 -191
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +19 -0
- package/dist/settings.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +279 -0
- package/dist/types/bledevicestatus.d.ts.map +1 -0
- package/dist/types/bledevicestatus.js +2 -0
- package/dist/types/bledevicestatus.js.map +1 -0
- package/dist/types/devicelist.d.ts +89 -0
- package/dist/types/devicelist.d.ts.map +1 -0
- package/dist/types/devicelist.js +6 -0
- package/dist/types/devicelist.js.map +1 -0
- package/dist/types/deviceresponse.d.ts +13 -0
- package/dist/types/deviceresponse.d.ts.map +1 -0
- package/dist/types/deviceresponse.js +2 -0
- package/dist/types/deviceresponse.js.map +1 -0
- package/dist/types/devicestatus.d.ts +149 -0
- package/dist/types/devicestatus.d.ts.map +1 -0
- package/dist/types/devicestatus.js +3 -0
- package/dist/types/devicestatus.js.map +1 -0
- package/dist/types/devicewebhookstatus.d.ts +156 -0
- package/dist/types/devicewebhookstatus.d.ts.map +1 -0
- package/dist/types/devicewebhookstatus.js +2 -0
- package/dist/types/devicewebhookstatus.js.map +1 -0
- package/dist/types/irdevicelist.d.ts +10 -0
- package/dist/types/irdevicelist.d.ts.map +1 -0
- package/dist/types/irdevicelist.js +2 -0
- package/dist/types/irdevicelist.js.map +1 -0
- package/dist/types/pushbody.d.ts +6 -0
- package/dist/types/pushbody.d.ts.map +1 -0
- package/dist/types/pushbody.js +2 -0
- package/dist/types/pushbody.js.map +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +28 -0
- package/dist/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/device/blindtilt.ts +224 -264
- package/src/device/bot.ts +208 -221
- package/src/device/ceilinglight.ts +211 -261
- package/src/device/colorbulb.ts +334 -397
- package/src/device/contact.ts +111 -146
- package/src/device/curtain.ts +220 -283
- package/src/device/device.ts +194 -245
- package/src/device/fan.ts +214 -230
- package/src/device/hub.ts +126 -246
- package/src/device/humidifier.ts +216 -243
- package/src/device/iosensor.ts +114 -166
- package/src/device/lightstrip.ts +302 -377
- package/src/device/lock.ts +187 -221
- package/src/device/meter.ts +116 -177
- package/src/device/meterplus.ts +117 -174
- package/src/device/motion.ts +99 -144
- package/src/device/plug.ts +110 -128
- package/src/device/robotvacuumcleaner.ts +189 -252
- package/src/device/waterdetector.ts +123 -139
- package/src/irdevice/airconditioner.ts +47 -52
- package/src/irdevice/airpurifier.ts +19 -18
- package/src/irdevice/camera.ts +11 -10
- package/src/irdevice/fan.ts +21 -20
- package/src/irdevice/irdevice.ts +95 -70
- package/src/irdevice/light.ts +17 -18
- package/src/irdevice/other.ts +78 -77
- package/src/irdevice/tv.ts +37 -36
- package/src/irdevice/vacuumcleaner.ts +11 -10
- package/src/irdevice/waterheater.ts +11 -10
- package/src/platform.ts +290 -272
- package/src/settings.ts +30 -239
- package/src/types/bledevicestatus.ts +305 -0
- package/src/types/devicelist.ts +124 -0
- package/src/types/deviceresponse.ts +15 -0
- package/src/types/devicestatus.ts +178 -0
- package/src/types/devicewebhookstatus.ts +196 -0
- package/src/types/irdevicelist.ts +15 -0
- package/src/types/pushbody.ts +9 -0
- package/src/utils.ts +33 -0
package/src/irdevice/tv.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { irdeviceBase } from './irdevice.js';
|
|
6
6
|
|
|
7
7
|
import type { SwitchBotPlatform } from '../platform.js';
|
|
8
|
-
import type { irDevicesConfig
|
|
8
|
+
import type { irDevicesConfig } from '../settings.js';
|
|
9
|
+
import type { irdevice } from '../types/irdevicelist.js';
|
|
9
10
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -124,7 +125,7 @@ export class TV extends irdeviceBase {
|
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
|
|
127
|
-
this.debugLog(
|
|
128
|
+
await this.debugLog(`VolumeSelector: ${value}`);
|
|
128
129
|
if (value === this.hap.Characteristic.VolumeSelector.INCREMENT) {
|
|
129
130
|
this.pushVolumeUpChanges();
|
|
130
131
|
} else {
|
|
@@ -135,61 +136,61 @@ export class TV extends irdeviceBase {
|
|
|
135
136
|
async RemoteKeySet(value: CharacteristicValue): Promise<void> {
|
|
136
137
|
switch (value) {
|
|
137
138
|
case this.hap.Characteristic.RemoteKey.REWIND: {
|
|
138
|
-
this.debugLog(
|
|
139
|
+
await this.debugLog('Set Remote Key Pressed: REWIND');
|
|
139
140
|
break;
|
|
140
141
|
}
|
|
141
142
|
case this.hap.Characteristic.RemoteKey.FAST_FORWARD: {
|
|
142
|
-
this.debugLog(
|
|
143
|
+
await this.debugLog('Set Remote Key Pressed: FAST_FORWARD');
|
|
143
144
|
break;
|
|
144
145
|
}
|
|
145
146
|
case this.hap.Characteristic.RemoteKey.NEXT_TRACK: {
|
|
146
|
-
this.debugLog(
|
|
147
|
+
await this.debugLog('Set Remote Key Pressed: NEXT_TRACK');
|
|
147
148
|
break;
|
|
148
149
|
}
|
|
149
150
|
case this.hap.Characteristic.RemoteKey.PREVIOUS_TRACK: {
|
|
150
|
-
this.debugLog(
|
|
151
|
+
await this.debugLog('Set Remote Key Pressed: PREVIOUS_TRACK');
|
|
151
152
|
break;
|
|
152
153
|
}
|
|
153
154
|
case this.hap.Characteristic.RemoteKey.ARROW_UP: {
|
|
154
|
-
this.debugLog(
|
|
155
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_UP');
|
|
155
156
|
//this.pushUpChanges();
|
|
156
157
|
break;
|
|
157
158
|
}
|
|
158
159
|
case this.hap.Characteristic.RemoteKey.ARROW_DOWN: {
|
|
159
|
-
this.debugLog(
|
|
160
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_DOWN');
|
|
160
161
|
//this.pushDownChanges();
|
|
161
162
|
break;
|
|
162
163
|
}
|
|
163
164
|
case this.hap.Characteristic.RemoteKey.ARROW_LEFT: {
|
|
164
|
-
this.debugLog(
|
|
165
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_LEFT');
|
|
165
166
|
//this.pushLeftChanges();
|
|
166
167
|
break;
|
|
167
168
|
}
|
|
168
169
|
case this.hap.Characteristic.RemoteKey.ARROW_RIGHT: {
|
|
169
|
-
this.debugLog(
|
|
170
|
+
await this.debugLog('Set Remote Key Pressed: ARROW_RIGHT');
|
|
170
171
|
//this.pushRightChanges();
|
|
171
172
|
break;
|
|
172
173
|
}
|
|
173
174
|
case this.hap.Characteristic.RemoteKey.SELECT: {
|
|
174
|
-
this.debugLog(
|
|
175
|
+
await this.debugLog('Set Remote Key Pressed: SELECT');
|
|
175
176
|
//this.pushOkChanges();
|
|
176
177
|
break;
|
|
177
178
|
}
|
|
178
179
|
case this.hap.Characteristic.RemoteKey.BACK: {
|
|
179
|
-
this.debugLog(
|
|
180
|
+
await this.debugLog('Set Remote Key Pressed: BACK');
|
|
180
181
|
//this.pushBackChanges();
|
|
181
182
|
break;
|
|
182
183
|
}
|
|
183
184
|
case this.hap.Characteristic.RemoteKey.EXIT: {
|
|
184
|
-
this.debugLog(
|
|
185
|
+
await this.debugLog('Set Remote Key Pressed: EXIT');
|
|
185
186
|
break;
|
|
186
187
|
}
|
|
187
188
|
case this.hap.Characteristic.RemoteKey.PLAY_PAUSE: {
|
|
188
|
-
this.debugLog(
|
|
189
|
+
await this.debugLog('Set Remote Key Pressed: PLAY_PAUSE');
|
|
189
190
|
break;
|
|
190
191
|
}
|
|
191
192
|
case this.hap.Characteristic.RemoteKey.INFORMATION: {
|
|
192
|
-
this.debugLog(
|
|
193
|
+
await this.debugLog('Set Remote Key Pressed: INFORMATION');
|
|
193
194
|
//this.pushMenuChanges();
|
|
194
195
|
break;
|
|
195
196
|
}
|
|
@@ -197,12 +198,12 @@ export class TV extends irdeviceBase {
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
|
|
200
|
-
this.debugLog(
|
|
201
|
+
await this.debugLog(`ActiveIdentifier: ${value}`);
|
|
201
202
|
this.Television.ActiveIdentifier = value;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
205
|
-
this.debugLog(
|
|
206
|
+
await this.debugLog(`Active (value): ${value}`);
|
|
206
207
|
|
|
207
208
|
this.Television.Active = value;
|
|
208
209
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -223,7 +224,7 @@ export class TV extends irdeviceBase {
|
|
|
223
224
|
* TV "command" "channelSub" "default" previous channel
|
|
224
225
|
*/
|
|
225
226
|
async pushTvOnChanges(): Promise<void> {
|
|
226
|
-
this.debugLog(
|
|
227
|
+
await this.debugLog('pushTvOnChanges'
|
|
227
228
|
+ ` Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`);
|
|
228
229
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
229
230
|
const commandType: string = await this.commandType();
|
|
@@ -238,7 +239,7 @@ export class TV extends irdeviceBase {
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
async pushTvOffChanges(): Promise<void> {
|
|
241
|
-
this.debugLog(
|
|
242
|
+
await this.debugLog('pushTvOffChanges'
|
|
242
243
|
+ ` Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`);
|
|
243
244
|
if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
244
245
|
const commandType: string = await this.commandType();
|
|
@@ -253,7 +254,7 @@ export class TV extends irdeviceBase {
|
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
async pushOkChanges(): Promise<void> {
|
|
256
|
-
this.debugLog(
|
|
257
|
+
await this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
257
258
|
if (!this.disablePushDetail) {
|
|
258
259
|
const bodyChange = JSON.stringify({
|
|
259
260
|
command: 'Ok',
|
|
@@ -265,7 +266,7 @@ export class TV extends irdeviceBase {
|
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
async pushBackChanges(): Promise<void> {
|
|
268
|
-
this.debugLog(
|
|
269
|
+
await this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
269
270
|
if (!this.disablePushDetail) {
|
|
270
271
|
const bodyChange = JSON.stringify({
|
|
271
272
|
command: 'Back',
|
|
@@ -277,7 +278,7 @@ export class TV extends irdeviceBase {
|
|
|
277
278
|
}
|
|
278
279
|
|
|
279
280
|
async pushMenuChanges(): Promise<void> {
|
|
280
|
-
this.debugLog(
|
|
281
|
+
await this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
281
282
|
if (!this.disablePushDetail) {
|
|
282
283
|
const bodyChange = JSON.stringify({
|
|
283
284
|
command: 'Menu',
|
|
@@ -289,7 +290,7 @@ export class TV extends irdeviceBase {
|
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
async pushUpChanges(): Promise<void> {
|
|
292
|
-
this.debugLog(
|
|
293
|
+
await this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
293
294
|
if (!this.disablePushDetail) {
|
|
294
295
|
const bodyChange = JSON.stringify({
|
|
295
296
|
command: 'Up',
|
|
@@ -301,7 +302,7 @@ export class TV extends irdeviceBase {
|
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
async pushDownChanges(): Promise<void> {
|
|
304
|
-
this.debugLog(
|
|
305
|
+
await this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
305
306
|
if (!this.disablePushDetail) {
|
|
306
307
|
const bodyChange = JSON.stringify({
|
|
307
308
|
command: 'Down',
|
|
@@ -313,7 +314,7 @@ export class TV extends irdeviceBase {
|
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
async pushRightChanges(): Promise<void> {
|
|
316
|
-
this.debugLog(
|
|
317
|
+
await this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
317
318
|
if (!this.disablePushDetail) {
|
|
318
319
|
const bodyChange = JSON.stringify({
|
|
319
320
|
command: 'Right',
|
|
@@ -325,7 +326,7 @@ export class TV extends irdeviceBase {
|
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
async pushLeftChanges(): Promise<void> {
|
|
328
|
-
this.debugLog(
|
|
329
|
+
await this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
329
330
|
if (!this.disablePushDetail) {
|
|
330
331
|
const bodyChange = JSON.stringify({
|
|
331
332
|
command: 'Left',
|
|
@@ -337,7 +338,7 @@ export class TV extends irdeviceBase {
|
|
|
337
338
|
}
|
|
338
339
|
|
|
339
340
|
async pushVolumeUpChanges(): Promise<void> {
|
|
340
|
-
this.debugLog(
|
|
341
|
+
await this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
341
342
|
if (!this.disablePushDetail) {
|
|
342
343
|
const bodyChange = JSON.stringify({
|
|
343
344
|
command: 'volumeAdd',
|
|
@@ -349,7 +350,7 @@ export class TV extends irdeviceBase {
|
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
async pushVolumeDownChanges(): Promise<void> {
|
|
352
|
-
this.debugLog(
|
|
353
|
+
await this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
353
354
|
if (!this.disablePushDetail) {
|
|
354
355
|
const bodyChange = JSON.stringify({
|
|
355
356
|
command: 'volumeSub',
|
|
@@ -361,9 +362,9 @@ export class TV extends irdeviceBase {
|
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
async pushTVChanges(bodyChange: any): Promise<void> {
|
|
364
|
-
this.debugLog(
|
|
365
|
+
await this.debugLog('pushTVChanges');
|
|
365
366
|
if (this.device.connectionType === 'OpenAPI') {
|
|
366
|
-
this.infoLog(
|
|
367
|
+
await this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
367
368
|
try {
|
|
368
369
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
369
370
|
const deviceStatus: any = await body.json();
|
|
@@ -380,27 +381,27 @@ export class TV extends irdeviceBase {
|
|
|
380
381
|
await this.pushChangeError(e);
|
|
381
382
|
}
|
|
382
383
|
} else {
|
|
383
|
-
this.warnLog(
|
|
384
|
-
+ ` 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`);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
389
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
389
390
|
// Active
|
|
390
391
|
if (this.Television.Active === undefined) {
|
|
391
|
-
this.debugLog(
|
|
392
|
+
await this.debugLog(`Active: ${this.Television.Active}`);
|
|
392
393
|
} else {
|
|
393
394
|
this.accessory.context.Active = this.Television.Active;
|
|
394
395
|
this.Television.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Television.Active);
|
|
395
|
-
this.debugLog(
|
|
396
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Television.Active}`);
|
|
396
397
|
}
|
|
397
398
|
// ActiveIdentifier
|
|
398
399
|
if (this.Television.ActiveIdentifier === undefined) {
|
|
399
|
-
this.debugLog(
|
|
400
|
+
await this.debugLog(`ActiveIdentifier: ${this.Television.ActiveIdentifier}`);
|
|
400
401
|
} else {
|
|
401
402
|
this.accessory.context.ActiveIdentifier = this.Television.ActiveIdentifier;
|
|
402
403
|
this.Television.Service.updateCharacteristic(this.hap.Characteristic.ActiveIdentifier, this.Television.ActiveIdentifier);
|
|
403
|
-
this.debugLog(
|
|
404
|
+
await this.debugLog('updateCharacteristic'
|
|
404
405
|
+ ` ActiveIdentifier: ${this.Television.ActiveIdentifier}`);
|
|
405
406
|
}
|
|
406
407
|
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { irdeviceBase } from './irdevice.js';
|
|
6
6
|
|
|
7
7
|
import type { SwitchBotPlatform } from '../platform.js';
|
|
8
|
-
import type { irDevicesConfig
|
|
8
|
+
import type { irDevicesConfig } from '../settings.js';
|
|
9
|
+
import type { irdevice } from '../types/irdevicelist.js';
|
|
9
10
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -47,7 +48,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
50
|
-
this.debugLog(
|
|
51
|
+
await this.debugLog(`On: ${value}`);
|
|
51
52
|
|
|
52
53
|
// Set the requested state
|
|
53
54
|
this.Switch.On = value;
|
|
@@ -65,7 +66,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
65
66
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
66
67
|
*/
|
|
67
68
|
async pushOnChanges(): Promise<void> {
|
|
68
|
-
this.debugLog(
|
|
69
|
+
await this.debugLog('pushOnChanges'
|
|
69
70
|
+ ` On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`);
|
|
70
71
|
if (this.Switch.On && !this.disablePushOn) {
|
|
71
72
|
const commandType: string = await this.commandType();
|
|
@@ -80,7 +81,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
async pushOffChanges(): Promise<void> {
|
|
83
|
-
this.debugLog(
|
|
84
|
+
await this.debugLog('pushOffChanges'
|
|
84
85
|
+ ` On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`);
|
|
85
86
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
86
87
|
const commandType: string = await this.commandType();
|
|
@@ -95,9 +96,9 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
98
|
-
this.debugLog(
|
|
99
|
+
await this.debugLog('pushChanges');
|
|
99
100
|
if (this.device.connectionType === 'OpenAPI') {
|
|
100
|
-
this.infoLog(
|
|
101
|
+
await this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
101
102
|
try {
|
|
102
103
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
103
104
|
const deviceStatus: any = await body.json();
|
|
@@ -114,19 +115,19 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
114
115
|
await this.pushChangeError(e);
|
|
115
116
|
}
|
|
116
117
|
} else {
|
|
117
|
-
this.warnLog(
|
|
118
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
118
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
123
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
123
124
|
// On
|
|
124
125
|
if (this.Switch.On === undefined) {
|
|
125
|
-
this.debugLog(
|
|
126
|
+
await this.debugLog(`On: ${this.Switch.On}`);
|
|
126
127
|
} else {
|
|
127
128
|
this.accessory.context.On = this.Switch.On;
|
|
128
129
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
129
|
-
this.debugLog(
|
|
130
|
+
await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { irdeviceBase } from './irdevice.js';
|
|
6
6
|
|
|
7
7
|
import type { SwitchBotPlatform } from '../platform.js';
|
|
8
|
-
import type { irDevicesConfig
|
|
8
|
+
import type { irDevicesConfig } from '../settings.js';
|
|
9
|
+
import type { irdevice } from '../types/irdevicelist.js';
|
|
9
10
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -48,7 +49,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
51
|
-
this.debugLog(
|
|
52
|
+
await this.debugLog(`Active: ${value}`);
|
|
52
53
|
|
|
53
54
|
this.Valve.Active = value;
|
|
54
55
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -67,7 +68,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
67
68
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
68
69
|
*/
|
|
69
70
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
70
|
-
this.debugLog(
|
|
71
|
+
await this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active},`
|
|
71
72
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
72
73
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
73
74
|
const commandType: string = await this.commandType();
|
|
@@ -82,7 +83,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
85
|
-
this.debugLog(
|
|
86
|
+
await this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active},`
|
|
86
87
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
87
88
|
if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
88
89
|
const commandType: string = await this.commandType();
|
|
@@ -97,9 +98,9 @@ export class WaterHeater extends irdeviceBase {
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
100
|
-
this.debugLog(
|
|
101
|
+
await this.debugLog('pushChanges');
|
|
101
102
|
if (this.device.connectionType === 'OpenAPI') {
|
|
102
|
-
this.infoLog(
|
|
103
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
103
104
|
try {
|
|
104
105
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
105
106
|
const deviceStatus: any = await body.json();
|
|
@@ -116,19 +117,19 @@ export class WaterHeater extends irdeviceBase {
|
|
|
116
117
|
await this.pushChangeError(e);
|
|
117
118
|
}
|
|
118
119
|
} else {
|
|
119
|
-
this.warnLog(
|
|
120
|
-
+ ` 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`);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
125
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
125
126
|
// Active
|
|
126
127
|
if (this.Valve.Active === undefined) {
|
|
127
|
-
this.debugLog(
|
|
128
|
+
await this.debugLog(`Active: ${this.Valve.Active}`);
|
|
128
129
|
} else {
|
|
129
130
|
this.accessory.context.Active = this.Valve.Active;
|
|
130
131
|
this.Valve.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Valve.Active);
|
|
131
|
-
this.debugLog(
|
|
132
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Valve.Active}`);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
|