@switchbot/homebridge-switchbot 1.3.1-beta.6 → 1.4.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 +12 -1
- package/config.schema.json +9 -22
- package/dist/devices/bots.d.ts +2 -0
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +109 -84
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +1 -0
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +18 -4
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.js +1 -1
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +1 -0
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +9 -1
- 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/meters.d.ts +5 -11
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +49 -47
- package/dist/devices/meters.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 +35 -16
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +2 -0
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +17 -1
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +2 -0
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +17 -0
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +1 -0
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +9 -0
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +1 -0
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +9 -0
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +1 -0
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +9 -0
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +1 -0
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +9 -0
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +1 -0
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +9 -0
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +1 -0
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +9 -0
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +1 -0
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +9 -0
- package/dist/irdevices/waterheaters.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 +6 -5
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +66 -66
- package/src/devices/bots.ts +88 -63
- package/src/devices/colorbulb.ts +18 -4
- package/src/devices/contact.ts +1 -1
- package/src/devices/humidifiers.ts +10 -1
- package/src/devices/indoorcam.ts +6 -0
- package/src/devices/meters.ts +50 -48
- package/src/devices/plugs.ts +38 -17
- package/src/irdevices/airconditioners.ts +17 -1
- package/src/irdevices/airpurifiers.ts +18 -0
- package/src/irdevices/cameras.ts +10 -0
- package/src/irdevices/fans.ts +10 -0
- package/src/irdevices/lights.ts +10 -0
- package/src/irdevices/others.ts +10 -0
- package/src/irdevices/tvs.ts +10 -0
- package/src/irdevices/vacuumcleaners.ts +10 -0
- package/src/irdevices/waterheaters.ts +10 -0
- package/src/platform.ts +37 -2
- package/src/settings.ts +7 -5
|
@@ -14,9 +14,11 @@ export class AirConditioner {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
ActiveCached!: CharacteristicValue;
|
|
17
18
|
RotationSpeed!: CharacteristicValue;
|
|
18
19
|
LastTemperature!: CharacteristicValue;
|
|
19
20
|
CurrentTemperature!: CharacteristicValue;
|
|
21
|
+
CurrentTemperatureCached!: CharacteristicValue;
|
|
20
22
|
TargetHeaterCoolerState?: CharacteristicValue;
|
|
21
23
|
CurrentHeaterCoolerState!: CharacteristicValue;
|
|
22
24
|
HeatingThresholdTemperature?: CharacteristicValue;
|
|
@@ -41,7 +43,17 @@ export class AirConditioner {
|
|
|
41
43
|
private accessory: PlatformAccessory,
|
|
42
44
|
public device: irdevice & irDevicesConfig,
|
|
43
45
|
) {
|
|
44
|
-
|
|
46
|
+
// default placeholders
|
|
47
|
+
if (this.Active === undefined) {
|
|
48
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
49
|
+
} else {
|
|
50
|
+
this.Active = this.accessory.context.Active;
|
|
51
|
+
}
|
|
52
|
+
if (this.CurrentTemperature === undefined) {
|
|
53
|
+
this.CurrentTemperature = 24;
|
|
54
|
+
} else {
|
|
55
|
+
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
56
|
+
}
|
|
45
57
|
|
|
46
58
|
// set accessory information
|
|
47
59
|
accessory
|
|
@@ -161,6 +173,8 @@ export class AirConditioner {
|
|
|
161
173
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
|
|
162
174
|
}
|
|
163
175
|
this.Active = value;
|
|
176
|
+
this.ActiveCached = this.Active;
|
|
177
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
164
178
|
}
|
|
165
179
|
|
|
166
180
|
private updateHomeKitCharacteristics() {
|
|
@@ -349,6 +363,8 @@ export class AirConditioner {
|
|
|
349
363
|
const push: any = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
350
364
|
this.platform.log.error(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
|
|
351
365
|
this.statusCode(push);
|
|
366
|
+
this.CurrentTemperatureCached = this.CurrentTemperature;
|
|
367
|
+
this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
|
|
352
368
|
this.updateHomeKitCharacteristics();
|
|
353
369
|
} catch (e: any) {
|
|
354
370
|
this.platform.log.error(`Air Conditioner: ${this.accessory.displayName} failed pushChanges`);
|
|
@@ -15,11 +15,13 @@ export class AirPurifier {
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
17
|
APActive!: CharacteristicValue;
|
|
18
|
+
ActiveCached!: CharacteristicValue;
|
|
18
19
|
CurrentAPTemp!: CharacteristicValue;
|
|
19
20
|
CurrentAPMode!: CharacteristicValue;
|
|
20
21
|
RotationSpeed!: CharacteristicValue;
|
|
21
22
|
CurrentAPFanSpeed!: CharacteristicValue;
|
|
22
23
|
CurrentTemperature!: CharacteristicValue;
|
|
24
|
+
CurrentTemperatureCached!: CharacteristicValue;
|
|
23
25
|
CurrentAirPurifierState!: CharacteristicValue;
|
|
24
26
|
CurrentHeaterCoolerState!: CharacteristicValue;
|
|
25
27
|
|
|
@@ -42,6 +44,18 @@ export class AirPurifier {
|
|
|
42
44
|
private accessory: PlatformAccessory,
|
|
43
45
|
public device: irdevice & irDevicesConfig,
|
|
44
46
|
) {
|
|
47
|
+
// default placeholders
|
|
48
|
+
if (this.Active === undefined) {
|
|
49
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
50
|
+
} else {
|
|
51
|
+
this.Active = this.accessory.context.Active;
|
|
52
|
+
}
|
|
53
|
+
if (this.CurrentTemperature === undefined) {
|
|
54
|
+
this.CurrentTemperature = 24;
|
|
55
|
+
} else {
|
|
56
|
+
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
57
|
+
}
|
|
58
|
+
|
|
45
59
|
// set accessory information
|
|
46
60
|
accessory
|
|
47
61
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -81,6 +95,8 @@ export class AirPurifier {
|
|
|
81
95
|
this.pushAirConditionerOnChanges();
|
|
82
96
|
}
|
|
83
97
|
this.Active = value;
|
|
98
|
+
this.ActiveCached = this.Active;
|
|
99
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
private updateHomeKitCharacteristics() {
|
|
@@ -210,6 +226,8 @@ export class AirPurifier {
|
|
|
210
226
|
this.platform.debug(`Air Purifier: ${this.accessory.displayName} pushChanges: ${push.data}`);
|
|
211
227
|
this.statusCode(push);
|
|
212
228
|
this.updateHomeKitCharacteristics();
|
|
229
|
+
this.CurrentTemperatureCached = this.CurrentTemperature;
|
|
230
|
+
this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
|
|
213
231
|
} catch (e: any) {
|
|
214
232
|
this.platform.log.error(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
215
233
|
if (this.deviceDebug) {
|
package/src/irdevices/cameras.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Camera {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
OnCached!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
private readonly deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
@@ -24,6 +25,13 @@ export class Camera {
|
|
|
24
25
|
private accessory: PlatformAccessory,
|
|
25
26
|
public device: irdevice & irDevicesConfig,
|
|
26
27
|
) {
|
|
28
|
+
// default placeholders
|
|
29
|
+
if (this.On === undefined) {
|
|
30
|
+
this.On = false;
|
|
31
|
+
} else {
|
|
32
|
+
this.On = this.accessory.context.On;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// set accessory information
|
|
28
36
|
accessory
|
|
29
37
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -110,6 +118,8 @@ export class Camera {
|
|
|
110
118
|
this.platform.debug(`Camera: ${this.accessory.displayName} pushChanges: ${push.data}`);
|
|
111
119
|
this.statusCode(push);
|
|
112
120
|
this.updateHomeKitCharacteristics();
|
|
121
|
+
this.OnCached = this.On;
|
|
122
|
+
this.accessory.context.On = this.OnCached;
|
|
113
123
|
} catch (e: any) {
|
|
114
124
|
this.platform.log.error(`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
115
125
|
if (this.deviceDebug) {
|
package/src/irdevices/fans.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Fan {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
ActiveCached!: CharacteristicValue;
|
|
17
18
|
ActiveIdentifier!: CharacteristicValue;
|
|
18
19
|
RotationSpeed!: CharacteristicValue;
|
|
19
20
|
SwingMode!: CharacteristicValue;
|
|
@@ -34,6 +35,13 @@ export class Fan {
|
|
|
34
35
|
private accessory: PlatformAccessory,
|
|
35
36
|
public device: irdevice & irDevicesConfig,
|
|
36
37
|
) {
|
|
38
|
+
// default placeholders
|
|
39
|
+
if (this.Active === undefined) {
|
|
40
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
41
|
+
} else {
|
|
42
|
+
this.Active = this.accessory.context.Active;
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
// set accessory information
|
|
38
46
|
accessory
|
|
39
47
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -164,6 +172,8 @@ export class Fan {
|
|
|
164
172
|
this.pushFanOnChanges();
|
|
165
173
|
}
|
|
166
174
|
this.Active = value;
|
|
175
|
+
this.ActiveCached = this.Active;
|
|
176
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
/**
|
package/src/irdevices/lights.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Light {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
OnCached!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
private readonly deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
@@ -24,6 +25,13 @@ export class Light {
|
|
|
24
25
|
private accessory: PlatformAccessory,
|
|
25
26
|
public device: irdevice & irDevicesConfig,
|
|
26
27
|
) {
|
|
28
|
+
// default placeholders
|
|
29
|
+
if (this.On === undefined) {
|
|
30
|
+
this.On = false;
|
|
31
|
+
} else {
|
|
32
|
+
this.On = this.accessory.context.On;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// set accessory information
|
|
28
36
|
accessory
|
|
29
37
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -142,6 +150,8 @@ export class Light {
|
|
|
142
150
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
143
151
|
this.platform.debug(`Light: ${this.accessory.displayName} pushChanges: ${push.data}`);
|
|
144
152
|
this.statusCode(push);
|
|
153
|
+
this.OnCached = this.On;
|
|
154
|
+
this.accessory.context.On = this.OnCached;
|
|
145
155
|
this.updateHomeKitCharacteristics();
|
|
146
156
|
} catch (e: any) {
|
|
147
157
|
this.platform.log.error(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
package/src/irdevices/others.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Others {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
ActiveCached!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
private readonly deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
@@ -24,6 +25,13 @@ export class Others {
|
|
|
24
25
|
private accessory: PlatformAccessory,
|
|
25
26
|
public device: irdevice & irDevicesConfig,
|
|
26
27
|
) {
|
|
28
|
+
// default placeholders
|
|
29
|
+
if (this.Active === undefined) {
|
|
30
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
31
|
+
} else {
|
|
32
|
+
this.Active = this.accessory.context.Active;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// set accessory information
|
|
28
36
|
accessory
|
|
29
37
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -54,6 +62,8 @@ export class Others {
|
|
|
54
62
|
this.pushOffChanges();
|
|
55
63
|
}
|
|
56
64
|
this.Active = value;
|
|
65
|
+
this.ActiveCached = this.Active;
|
|
66
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
private updateHomeKitCharacteristics() {
|
package/src/irdevices/tvs.ts
CHANGED
|
@@ -15,6 +15,7 @@ export class TV {
|
|
|
15
15
|
|
|
16
16
|
// Characteristic Values
|
|
17
17
|
Active!: CharacteristicValue;
|
|
18
|
+
ActiveCached!: CharacteristicValue;
|
|
18
19
|
ActiveIdentifier!: CharacteristicValue;
|
|
19
20
|
|
|
20
21
|
// Others
|
|
@@ -29,6 +30,13 @@ export class TV {
|
|
|
29
30
|
private accessory: PlatformAccessory,
|
|
30
31
|
public device: irdevice & irDevicesConfig,
|
|
31
32
|
) {
|
|
33
|
+
// default placeholders
|
|
34
|
+
if (this.Active === undefined) {
|
|
35
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
36
|
+
} else {
|
|
37
|
+
this.Active = this.accessory.context.Active;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
// set accessory information
|
|
33
41
|
accessory
|
|
34
42
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -207,6 +215,8 @@ export class TV {
|
|
|
207
215
|
this.pushTvOnChanges();
|
|
208
216
|
}
|
|
209
217
|
this.Active = value;
|
|
218
|
+
this.ActiveCached = this.Active;
|
|
219
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
222
|
|
|
@@ -14,6 +14,7 @@ export class VacuumCleaner {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
OnCached!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
private readonly deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
@@ -24,6 +25,13 @@ export class VacuumCleaner {
|
|
|
24
25
|
private accessory: PlatformAccessory,
|
|
25
26
|
public device: irdevice & irDevicesConfig,
|
|
26
27
|
) {
|
|
28
|
+
// default placeholders
|
|
29
|
+
if (this.On === undefined) {
|
|
30
|
+
this.On = false;
|
|
31
|
+
} else {
|
|
32
|
+
this.On = this.accessory.context.On;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// set accessory information
|
|
28
36
|
accessory
|
|
29
37
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -109,6 +117,8 @@ export class VacuumCleaner {
|
|
|
109
117
|
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
110
118
|
this.platform.debug(`Vacuum Cleaner: ${this.accessory.displayName} pushChanges: ${push.data}`);
|
|
111
119
|
this.statusCode(push);
|
|
120
|
+
this.OnCached = this.On;
|
|
121
|
+
this.accessory.context.On = this.OnCached;
|
|
112
122
|
this.updateHomeKitCharacteristics();
|
|
113
123
|
} catch (e: any) {
|
|
114
124
|
this.platform.log.error(`Vacuum Cleaner: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
@@ -14,6 +14,7 @@ export class WaterHeater {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
ActiveCached!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
private readonly deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
|
|
@@ -24,6 +25,13 @@ export class WaterHeater {
|
|
|
24
25
|
private accessory: PlatformAccessory,
|
|
25
26
|
public device: irdevice & irDevicesConfig,
|
|
26
27
|
) {
|
|
28
|
+
// default placeholders
|
|
29
|
+
if (this.Active === undefined) {
|
|
30
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
31
|
+
} else {
|
|
32
|
+
this.Active = this.accessory.context.Active;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// set accessory information
|
|
28
36
|
accessory
|
|
29
37
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
@@ -71,6 +79,8 @@ export class WaterHeater {
|
|
|
71
79
|
this.service.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.IN_USE);
|
|
72
80
|
}
|
|
73
81
|
this.Active = value;
|
|
82
|
+
this.ActiveCached = this.Active;
|
|
83
|
+
this.accessory.context.Active = this.ActiveCached;
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
private updateHomeKitCharacteristics() {
|
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
|
|
package/src/settings.ts
CHANGED
|
@@ -49,10 +49,10 @@ export interface devicesConfig extends device {
|
|
|
49
49
|
colorbulb?: colorbulb;
|
|
50
50
|
ble?: string;
|
|
51
51
|
hide_device?: boolean;
|
|
52
|
+
offline?: boolean;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export type meter = {
|
|
55
|
-
unit?: number;
|
|
56
56
|
hide_temperature?: boolean;
|
|
57
57
|
hide_humidity?: boolean;
|
|
58
58
|
};
|
|
@@ -280,10 +280,7 @@ export type serviceData = {
|
|
|
280
280
|
//Humidifier's AutoMode
|
|
281
281
|
autoMode?: boolean;
|
|
282
282
|
//Meter Temperature Levels
|
|
283
|
-
temperature?:
|
|
284
|
-
c: number,
|
|
285
|
-
f: number
|
|
286
|
-
};
|
|
283
|
+
temperature?: temperature;
|
|
287
284
|
// Fahrenheit enabled for Meter
|
|
288
285
|
fahrenheit: boolean;
|
|
289
286
|
// Humidity level for Meter
|
|
@@ -303,6 +300,11 @@ export type serviceData = {
|
|
|
303
300
|
position?: number;
|
|
304
301
|
};
|
|
305
302
|
|
|
303
|
+
export type temperature = {
|
|
304
|
+
c: number;
|
|
305
|
+
f: number;
|
|
306
|
+
};
|
|
307
|
+
|
|
306
308
|
export type switchbot = {
|
|
307
309
|
discover: (
|
|
308
310
|
arg0:
|