@switchbot/homebridge-switchbot 1.3.1-beta.7 → 1.3.1-beta.8
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 +9 -1
- package/config.schema.json +9 -0
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +6 -0
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +7 -1
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +6 -0
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/indoorcam.d.ts.map +1 -1
- package/dist/devices/indoorcam.js +6 -0
- package/dist/devices/indoorcam.js.map +1 -1
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +6 -0
- package/dist/devices/plugs.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +46 -2
- 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 +1 -1
- package/src/devices/bots.ts +6 -0
- package/src/devices/colorbulb.ts +7 -1
- package/src/devices/humidifiers.ts +6 -0
- package/src/devices/indoorcam.ts +6 -0
- package/src/devices/plugs.ts +6 -0
- package/src/platform.ts +37 -2
- package/src/settings.ts +1 -0
package/src/platform.ts
CHANGED
|
@@ -267,8 +267,43 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
267
267
|
this.log.error('Neither SwitchBot OpenToken or Device Config are not set.');
|
|
268
268
|
}
|
|
269
269
|
} catch (e: any) {
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
if (e.message.includes('400')) {
|
|
271
|
+
this.log.error('Failed to Discover Devices: Bad Request');
|
|
272
|
+
this.debug('The client has issued an invalid request. This is commonly used to specify validation errors in a request payload.');
|
|
273
|
+
} else if (e.message.includes('401')) {
|
|
274
|
+
this.log.error('Failed to Discover Devices: Unauthorized Request');
|
|
275
|
+
this.debug('Authorization for the API is required, but the request has not been authenticated.');
|
|
276
|
+
} else if (e.message.includes('403')) {
|
|
277
|
+
this.log.error('Failed to Discover Devices: Forbidden Request');
|
|
278
|
+
this.debug('The request has been authenticated but does not have appropriate permissions, or a requested resource is not found.');
|
|
279
|
+
} else if (e.message.includes('404')) {
|
|
280
|
+
this.log.error('Failed to Discover Devices: Requst Not Found');
|
|
281
|
+
this.debug('Specifies the requested path does not exist.');
|
|
282
|
+
} else if (e.message.includes('406')) {
|
|
283
|
+
this.log.error('Failed to Discover Devices: Request Not Acceptable');
|
|
284
|
+
this.debug('The client has requested a MIME type via the Accept header for a value not supported by the server.');
|
|
285
|
+
} else if (e.message.includes('415')) {
|
|
286
|
+
this.log.error('Failed to Discover Devices: Unsupported Requst Header');
|
|
287
|
+
this.debug('The client has defined a contentType header that is not supported by the server.');
|
|
288
|
+
} else if (e.message.includes('422')) {
|
|
289
|
+
this.log.error('Failed to Discover Devices: Unprocessable Entity');
|
|
290
|
+
this.debug('The client has made a valid request, but the server cannot process it.'
|
|
291
|
+
+ ' This is often used for APIs for which certain limits have been exceeded.');
|
|
292
|
+
} else if (e.message.includes('429')) {
|
|
293
|
+
this.log.error('Failed to Discover Devices: Too Many Requests');
|
|
294
|
+
this.debug('The client has exceeded the number of requests allowed for a given time window.');
|
|
295
|
+
} else if (e.message.includes('500')) {
|
|
296
|
+
this.log.error('Failed to Discover Devices: Internal Server Error');
|
|
297
|
+
this.debug('An unexpected error on the SmartThings servers has occurred. These errors should be rare.');
|
|
298
|
+
} else {
|
|
299
|
+
this.log.error('Failed to Discover Devices');
|
|
300
|
+
}
|
|
301
|
+
if (this.config.options?.debug === 'device') {
|
|
302
|
+
this.log.error(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}`);
|
|
303
|
+
}
|
|
304
|
+
if (this.config.options?.debug === 'debug' || this.debugMode) {
|
|
305
|
+
this.log.error(`Failed to Discover Devices, Error: ${JSON.stringify(e)}`);
|
|
306
|
+
}
|
|
272
307
|
}
|
|
273
308
|
}
|
|
274
309
|
|