@switchbot/homebridge-switchbot 1.5.1-beta.3 → 1.6.1-beta.0
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 +15 -2
- package/config.schema.json +9 -0
- package/dist/devices/bots.d.ts +4 -0
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +79 -18
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +3 -1
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +34 -11
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +2 -0
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +21 -6
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +2 -0
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +21 -6
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +2 -0
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +21 -6
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +2 -0
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +20 -5
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +2 -0
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +40 -9
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +2 -0
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +19 -4
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.js +3 -3
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.js +3 -3
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.js +3 -3
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.js +3 -3
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.js +3 -3
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.js +3 -3
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.js +3 -3
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +3 -3
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.js +2 -2
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +0 -5
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +4 -2
- package/src/devices/bots.ts +81 -18
- package/src/devices/colorbulb.ts +39 -12
- package/src/devices/contact.ts +22 -6
- package/src/devices/curtains.ts +22 -6
- package/src/devices/humidifiers.ts +22 -6
- package/src/devices/meters.ts +21 -5
- package/src/devices/motion.ts +40 -9
- package/src/devices/plugs.ts +20 -4
- package/src/irdevices/airconditioners.ts +3 -3
- package/src/irdevices/airpurifiers.ts +3 -3
- package/src/irdevices/cameras.ts +3 -3
- package/src/irdevices/fans.ts +3 -3
- package/src/irdevices/lights.ts +3 -3
- package/src/irdevices/others.ts +3 -3
- package/src/irdevices/tvs.ts +3 -3
- package/src/irdevices/vacuumcleaners.ts +3 -3
- package/src/irdevices/waterheaters.ts +2 -2
- package/src/platform.ts +0 -5
- package/src/settings.ts +1 -0
package/src/devices/motion.ts
CHANGED
|
@@ -34,6 +34,7 @@ export class Motion {
|
|
|
34
34
|
lightLevel!: serviceData['lightLevel'];
|
|
35
35
|
|
|
36
36
|
// Config
|
|
37
|
+
scanDuration!: number;
|
|
37
38
|
deviceLogging!: string;
|
|
38
39
|
deviceRefreshRate!: number;
|
|
39
40
|
|
|
@@ -47,8 +48,9 @@ export class Motion {
|
|
|
47
48
|
public device: device & devicesConfig,
|
|
48
49
|
) {
|
|
49
50
|
// default placeholders
|
|
50
|
-
this.refreshRate();
|
|
51
51
|
this.logs();
|
|
52
|
+
this.scan();
|
|
53
|
+
this.refreshRate();
|
|
52
54
|
this.MotionDetected = false;
|
|
53
55
|
|
|
54
56
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
@@ -125,19 +127,33 @@ export class Motion {
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
scan() {
|
|
131
|
+
if (this.device.scanDuration) {
|
|
132
|
+
this.scanDuration = this.accessory.context.scanDuration = this.device.scanDuration;
|
|
133
|
+
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
134
|
+
this.warnLog(`Bot: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
138
|
+
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
139
|
+
this.warnLog(`Bot: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
128
144
|
logs() {
|
|
129
145
|
if (this.platform.debugMode) {
|
|
130
146
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
131
|
-
this.warnLog(`
|
|
147
|
+
this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
132
148
|
} else if (this.device.logging) {
|
|
133
149
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
134
150
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
135
|
-
this.warnLog(`
|
|
151
|
+
this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
136
152
|
}
|
|
137
153
|
} else if (this.platform.config.options?.logging) {
|
|
138
154
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
139
155
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
140
|
-
this.warnLog(`
|
|
156
|
+
this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
141
157
|
}
|
|
142
158
|
} else {
|
|
143
159
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
@@ -178,10 +194,25 @@ export class Motion {
|
|
|
178
194
|
}
|
|
179
195
|
|
|
180
196
|
private async openAPIparseStatus() {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
197
|
+
try {
|
|
198
|
+
if (this.platform.config.credentials?.openToken) {
|
|
199
|
+
this.debugLog(`Motion Sensor: ${this.accessory.displayName} OpenAPI parseStatus`);
|
|
200
|
+
if (typeof this.deviceStatus.body.moveDetected === 'boolean') {
|
|
201
|
+
this.MotionDetected = this.deviceStatus.body.moveDetected;
|
|
202
|
+
}
|
|
203
|
+
this.debugLog(`Motion Sensor: ${this.accessory.displayName} MotionDetected: ${this.MotionDetected}`);
|
|
204
|
+
}
|
|
205
|
+
} catch (e: any) {
|
|
206
|
+
this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed parseStatus with OpenAPI Connection`);
|
|
207
|
+
if (this.deviceLogging === 'debug') {
|
|
208
|
+
this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed parseStatus with OpenAPI Connection,`
|
|
209
|
+
+ ` Error Message: ${JSON.stringify(e.message)}`);
|
|
210
|
+
}
|
|
211
|
+
if (this.platform.debugMode) {
|
|
212
|
+
this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed parseStatus with OpenAPI Connection,`
|
|
213
|
+
+ ` Error: ${JSON.stringify(e)}`);
|
|
214
|
+
}
|
|
215
|
+
this.apiError(e);
|
|
185
216
|
}
|
|
186
217
|
}
|
|
187
218
|
|
|
@@ -231,7 +262,7 @@ export class Motion {
|
|
|
231
262
|
}
|
|
232
263
|
};
|
|
233
264
|
// Wait 10 seconds
|
|
234
|
-
return switchbot.wait(
|
|
265
|
+
return switchbot.wait(this.scanDuration * 1000);
|
|
235
266
|
}).then(async () => {
|
|
236
267
|
// Stop to monitor
|
|
237
268
|
switchbot.stopScan();
|
package/src/devices/plugs.ts
CHANGED
|
@@ -18,6 +18,7 @@ export class Plug {
|
|
|
18
18
|
deviceStatus!: deviceStatusResponse;
|
|
19
19
|
|
|
20
20
|
// Config
|
|
21
|
+
scanDuration!: number;
|
|
21
22
|
deviceLogging!: string;
|
|
22
23
|
deviceRefreshRate!: number;
|
|
23
24
|
|
|
@@ -31,8 +32,9 @@ export class Plug {
|
|
|
31
32
|
public device: device & devicesConfig,
|
|
32
33
|
) {
|
|
33
34
|
// default placeholders
|
|
34
|
-
this.refreshRate();
|
|
35
35
|
this.logs();
|
|
36
|
+
this.scan();
|
|
37
|
+
this.refreshRate();
|
|
36
38
|
if (this.On === undefined) {
|
|
37
39
|
this.On = false;
|
|
38
40
|
} else {
|
|
@@ -128,19 +130,33 @@ export class Plug {
|
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
scan() {
|
|
134
|
+
if (this.device.scanDuration) {
|
|
135
|
+
this.scanDuration = this.accessory.context.scanDuration = this.device.scanDuration;
|
|
136
|
+
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
137
|
+
this.warnLog(`Bot: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
this.scanDuration = this.accessory.context.scanDuration = 1;
|
|
141
|
+
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
142
|
+
this.warnLog(`Bot: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
131
147
|
logs() {
|
|
132
148
|
if (this.platform.debugMode) {
|
|
133
149
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
134
|
-
this.warnLog(`
|
|
150
|
+
this.warnLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
135
151
|
} else if (this.device.logging) {
|
|
136
152
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
137
153
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
138
|
-
this.warnLog(`
|
|
154
|
+
this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
139
155
|
}
|
|
140
156
|
} else if (this.platform.config.options?.logging) {
|
|
141
157
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
142
158
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
143
|
-
this.warnLog(`
|
|
159
|
+
this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
144
160
|
}
|
|
145
161
|
} else {
|
|
146
162
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
@@ -169,16 +169,16 @@ export class AirConditioner {
|
|
|
169
169
|
logs() {
|
|
170
170
|
if (this.platform.debugMode) {
|
|
171
171
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
172
|
-
this.warnLog(`
|
|
172
|
+
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
173
173
|
} else if (this.device.logging) {
|
|
174
174
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
175
175
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
176
|
-
this.warnLog(`
|
|
176
|
+
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
177
177
|
}
|
|
178
178
|
} else if (this.platform.config.options?.logging) {
|
|
179
179
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
180
180
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
181
|
-
this.warnLog(`
|
|
181
|
+
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
182
182
|
}
|
|
183
183
|
} else {
|
|
184
184
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
@@ -90,16 +90,16 @@ export class AirPurifier {
|
|
|
90
90
|
logs() {
|
|
91
91
|
if (this.platform.debugMode) {
|
|
92
92
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
93
|
-
this.warnLog(`
|
|
93
|
+
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
94
94
|
} else if (this.device.logging) {
|
|
95
95
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
96
96
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
97
|
-
this.warnLog(`
|
|
97
|
+
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
98
98
|
}
|
|
99
99
|
} else if (this.platform.config.options?.logging) {
|
|
100
100
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
101
101
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
102
|
-
this.warnLog(`
|
|
102
|
+
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
103
103
|
}
|
|
104
104
|
} else {
|
|
105
105
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/irdevices/cameras.ts
CHANGED
|
@@ -60,16 +60,16 @@ export class Camera {
|
|
|
60
60
|
logs() {
|
|
61
61
|
if (this.platform.debugMode) {
|
|
62
62
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
63
|
-
this.warnLog(`
|
|
63
|
+
this.warnLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
64
64
|
} else if (this.device.logging) {
|
|
65
65
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
66
66
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
67
|
-
this.warnLog(`
|
|
67
|
+
this.warnLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
68
68
|
}
|
|
69
69
|
} else if (this.platform.config.options?.logging) {
|
|
70
70
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
71
71
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
72
|
-
this.warnLog(`
|
|
72
|
+
this.warnLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
73
73
|
}
|
|
74
74
|
} else {
|
|
75
75
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/irdevices/fans.ts
CHANGED
|
@@ -119,16 +119,16 @@ export class Fan {
|
|
|
119
119
|
logs() {
|
|
120
120
|
if (this.platform.debugMode) {
|
|
121
121
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
122
|
-
this.warnLog(`
|
|
122
|
+
this.warnLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
123
123
|
} else if (this.device.logging) {
|
|
124
124
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
125
125
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
126
|
-
this.warnLog(`
|
|
126
|
+
this.warnLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
127
127
|
}
|
|
128
128
|
} else if (this.platform.config.options?.logging) {
|
|
129
129
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
130
130
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
131
|
-
this.warnLog(`
|
|
131
|
+
this.warnLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
134
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/irdevices/lights.ts
CHANGED
|
@@ -75,16 +75,16 @@ export class Light {
|
|
|
75
75
|
logs() {
|
|
76
76
|
if (this.platform.debugMode) {
|
|
77
77
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
78
|
-
this.warnLog(`
|
|
78
|
+
this.warnLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
79
79
|
} else if (this.device.logging) {
|
|
80
80
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
81
81
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
82
|
-
this.warnLog(`
|
|
82
|
+
this.warnLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
83
83
|
}
|
|
84
84
|
} else if (this.platform.config.options?.logging) {
|
|
85
85
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
86
86
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
87
|
-
this.warnLog(`
|
|
87
|
+
this.warnLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
88
88
|
}
|
|
89
89
|
} else {
|
|
90
90
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/irdevices/others.ts
CHANGED
|
@@ -79,16 +79,16 @@ export class Others {
|
|
|
79
79
|
logs() {
|
|
80
80
|
if (this.platform.debugMode) {
|
|
81
81
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
82
|
-
this.warnLog(`
|
|
82
|
+
this.warnLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
83
83
|
} else if (this.device.logging) {
|
|
84
84
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
85
85
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
86
|
-
this.warnLog(`
|
|
86
|
+
this.warnLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
87
87
|
}
|
|
88
88
|
} else if (this.platform.config.options?.logging) {
|
|
89
89
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
90
90
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
91
|
-
this.warnLog(`
|
|
91
|
+
this.warnLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
92
92
|
}
|
|
93
93
|
} else {
|
|
94
94
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/irdevices/tvs.ts
CHANGED
|
@@ -131,16 +131,16 @@ export class TV {
|
|
|
131
131
|
logs() {
|
|
132
132
|
if (this.platform.debugMode) {
|
|
133
133
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
134
|
-
this.warnLog(
|
|
134
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
135
135
|
} else if (this.device.logging) {
|
|
136
136
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
137
137
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
138
|
-
this.warnLog(
|
|
138
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
139
139
|
}
|
|
140
140
|
} else if (this.platform.config.options?.logging) {
|
|
141
141
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
142
142
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
143
|
-
this.warnLog(
|
|
143
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
144
144
|
}
|
|
145
145
|
} else {
|
|
146
146
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
@@ -60,16 +60,16 @@ export class VacuumCleaner {
|
|
|
60
60
|
logs() {
|
|
61
61
|
if (this.platform.debugMode) {
|
|
62
62
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
63
|
-
this.warnLog(`
|
|
63
|
+
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
64
64
|
} else if (this.device.logging) {
|
|
65
65
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
66
66
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
67
|
-
this.warnLog(`
|
|
67
|
+
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
68
68
|
}
|
|
69
69
|
} else if (this.platform.config.options?.logging) {
|
|
70
70
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
71
71
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
72
|
-
this.warnLog(`
|
|
72
|
+
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
73
73
|
}
|
|
74
74
|
} else {
|
|
75
75
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
@@ -73,12 +73,12 @@ export class WaterHeater {
|
|
|
73
73
|
} else if (this.device.logging) {
|
|
74
74
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
75
75
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
76
|
-
this.warnLog(`
|
|
76
|
+
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
77
77
|
}
|
|
78
78
|
} else if (this.platform.config.options?.logging) {
|
|
79
79
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
80
80
|
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
81
|
-
this.warnLog(`
|
|
81
|
+
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
82
82
|
}
|
|
83
83
|
} else {
|
|
84
84
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
package/src/platform.ts
CHANGED
|
@@ -144,11 +144,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
144
144
|
if (!deviceConfig.configDeviceType && deviceConfig.ble) {
|
|
145
145
|
throw new Error('The devices config section is missing the *Device Type* in the config, Check Your Conifg.');
|
|
146
146
|
}
|
|
147
|
-
if (deviceConfig.bot) {
|
|
148
|
-
if (!deviceConfig.bot?.mode) {
|
|
149
|
-
this.errorLog('You must set your Bot to Press or Switch Mode');
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
147
|
}
|
|
153
148
|
}
|
|
154
149
|
}
|