@switchbot/homebridge-switchbot 1.5.1-beta.2 → 1.6.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 +7 -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 +81 -25
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +4 -9
- 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 -11
- 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 +23 -13
- 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 -11
- 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 -10
- 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 +20 -10
- 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 -9
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +3 -8
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +3 -8
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +3 -8
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +3 -8
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +3 -8
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +2 -0
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +30 -14
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +3 -8
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +3 -8
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +3 -8
- 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 +68 -68
- package/src/devices/bots.ts +83 -25
- package/src/devices/colorbulb.ts +4 -9
- package/src/devices/contact.ts +22 -11
- package/src/devices/curtains.ts +24 -13
- package/src/devices/humidifiers.ts +22 -11
- package/src/devices/meters.ts +21 -10
- package/src/devices/motion.ts +21 -10
- package/src/devices/plugs.ts +20 -9
- package/src/irdevices/airconditioners.ts +3 -8
- package/src/irdevices/airpurifiers.ts +3 -8
- package/src/irdevices/cameras.ts +3 -8
- package/src/irdevices/fans.ts +3 -8
- package/src/irdevices/lights.ts +3 -8
- package/src/irdevices/others.ts +31 -14
- package/src/irdevices/tvs.ts +3 -8
- package/src/irdevices/vacuumcleaners.ts +3 -8
- package/src/irdevices/waterheaters.ts +3 -8
- package/src/platform.ts +0 -5
- package/src/settings.ts +1 -0
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,27 +130,36 @@ 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
|
-
|
|
135
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
136
|
-
}
|
|
150
|
+
this.warnLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
137
151
|
} else if (this.device.logging) {
|
|
138
152
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
139
|
-
if (this.
|
|
153
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
140
154
|
this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
141
155
|
}
|
|
142
156
|
} else if (this.platform.config.options?.logging) {
|
|
143
157
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
144
|
-
if (this.
|
|
158
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
145
159
|
this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
146
160
|
}
|
|
147
161
|
} else {
|
|
148
162
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
149
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
150
|
-
this.warnLog(`Plug: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
151
|
-
}
|
|
152
163
|
}
|
|
153
164
|
}
|
|
154
165
|
|
|
@@ -169,24 +169,19 @@ export class AirConditioner {
|
|
|
169
169
|
logs() {
|
|
170
170
|
if (this.platform.debugMode) {
|
|
171
171
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
172
|
-
|
|
173
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
174
|
-
}
|
|
172
|
+
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
175
173
|
} else if (this.device.logging) {
|
|
176
174
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
177
|
-
if (this.
|
|
175
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
178
176
|
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
179
177
|
}
|
|
180
178
|
} else if (this.platform.config.options?.logging) {
|
|
181
179
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
182
|
-
if (this.
|
|
180
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
183
181
|
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
184
182
|
}
|
|
185
183
|
} else {
|
|
186
184
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
187
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
188
|
-
this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
189
|
-
}
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
187
|
|
|
@@ -90,24 +90,19 @@ export class AirPurifier {
|
|
|
90
90
|
logs() {
|
|
91
91
|
if (this.platform.debugMode) {
|
|
92
92
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
93
|
-
|
|
94
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
95
|
-
}
|
|
93
|
+
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
96
94
|
} else if (this.device.logging) {
|
|
97
95
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
98
|
-
if (this.
|
|
96
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
99
97
|
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
100
98
|
}
|
|
101
99
|
} else if (this.platform.config.options?.logging) {
|
|
102
100
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
103
|
-
if (this.
|
|
101
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
104
102
|
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
105
103
|
}
|
|
106
104
|
} else {
|
|
107
105
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
108
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
109
|
-
this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
110
|
-
}
|
|
111
106
|
}
|
|
112
107
|
}
|
|
113
108
|
|
package/src/irdevices/cameras.ts
CHANGED
|
@@ -60,24 +60,19 @@ export class Camera {
|
|
|
60
60
|
logs() {
|
|
61
61
|
if (this.platform.debugMode) {
|
|
62
62
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
63
|
-
|
|
64
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
65
|
-
}
|
|
63
|
+
this.warnLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
66
64
|
} else if (this.device.logging) {
|
|
67
65
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
68
|
-
if (this.
|
|
66
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
69
67
|
this.warnLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
70
68
|
}
|
|
71
69
|
} else if (this.platform.config.options?.logging) {
|
|
72
70
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
73
|
-
if (this.
|
|
71
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
74
72
|
this.warnLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
75
73
|
}
|
|
76
74
|
} else {
|
|
77
75
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
78
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
79
|
-
this.warnLog(`Camera: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
80
|
-
}
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
|
package/src/irdevices/fans.ts
CHANGED
|
@@ -119,24 +119,19 @@ export class Fan {
|
|
|
119
119
|
logs() {
|
|
120
120
|
if (this.platform.debugMode) {
|
|
121
121
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
122
|
-
|
|
123
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
124
|
-
}
|
|
122
|
+
this.warnLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
125
123
|
} else if (this.device.logging) {
|
|
126
124
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
127
|
-
if (this.
|
|
125
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
128
126
|
this.warnLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
129
127
|
}
|
|
130
128
|
} else if (this.platform.config.options?.logging) {
|
|
131
129
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
132
|
-
if (this.
|
|
130
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
133
131
|
this.warnLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
134
132
|
}
|
|
135
133
|
} else {
|
|
136
134
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
137
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
138
|
-
this.warnLog(`Fan: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
139
|
-
}
|
|
140
135
|
}
|
|
141
136
|
}
|
|
142
137
|
|
package/src/irdevices/lights.ts
CHANGED
|
@@ -75,24 +75,19 @@ export class Light {
|
|
|
75
75
|
logs() {
|
|
76
76
|
if (this.platform.debugMode) {
|
|
77
77
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
78
|
-
|
|
79
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
80
|
-
}
|
|
78
|
+
this.warnLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
81
79
|
} else if (this.device.logging) {
|
|
82
80
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
83
|
-
if (this.
|
|
81
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
84
82
|
this.warnLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
85
83
|
}
|
|
86
84
|
} else if (this.platform.config.options?.logging) {
|
|
87
85
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
88
|
-
if (this.
|
|
86
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
89
87
|
this.warnLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
90
88
|
}
|
|
91
89
|
} else {
|
|
92
90
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
93
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
94
|
-
this.warnLog(`Light: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
95
|
-
}
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
93
|
|
package/src/irdevices/others.ts
CHANGED
|
@@ -18,6 +18,7 @@ export class Others {
|
|
|
18
18
|
|
|
19
19
|
// Config
|
|
20
20
|
deviceLogging!: string;
|
|
21
|
+
otherDeviceType?: string;
|
|
21
22
|
|
|
22
23
|
constructor(
|
|
23
24
|
private readonly platform: SwitchBotPlatform,
|
|
@@ -26,6 +27,7 @@ export class Others {
|
|
|
26
27
|
) {
|
|
27
28
|
// default placeholders
|
|
28
29
|
this.logs();
|
|
30
|
+
this.deviceType();
|
|
29
31
|
if (this.Active === undefined) {
|
|
30
32
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
31
33
|
} else {
|
|
@@ -41,40 +43,55 @@ export class Others {
|
|
|
41
43
|
|
|
42
44
|
// get the Television service if it exists, otherwise create a new Television service
|
|
43
45
|
// you can create multiple services for each accessory
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
this.service = accessory.addService(this.platform.Service.Fanv2, `${accessory.displayName} Fan`);
|
|
46
|
+
if (this.otherDeviceType !== 'Fan') {
|
|
47
|
+
this.debugLog(`Other: ${accessory.displayName} Removing Fanv2 Service`);
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
if (this.otherDeviceType === undefined) {
|
|
50
|
+
this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${device.other?.deviceType}`);
|
|
51
|
+
}
|
|
52
|
+
this.service = this.accessory.getService(this.platform.Service.Fanv2);
|
|
53
|
+
accessory.removeService(this.service!);
|
|
54
|
+
} else if (!this.service && this.otherDeviceType === 'Fan') {
|
|
55
|
+
this.debugLog(`Other: ${accessory.displayName} Add Fanv2 Service`);
|
|
56
|
+
(this.service =
|
|
57
|
+
this.accessory.getService(this.platform.Service.Fanv2) ||
|
|
58
|
+
this.accessory.addService(this.platform.Service.Fanv2)), `${accessory.displayName} Fan`;
|
|
59
|
+
|
|
60
|
+
this.service.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Fan`);
|
|
49
61
|
|
|
50
62
|
this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
51
63
|
} else {
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
this.debugLog(`Other: ${accessory.displayName} Fanv2 Service Not Added, deviceType: ${device.other?.deviceType}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
deviceType() {
|
|
69
|
+
if (this.device?.other?.deviceType) {
|
|
70
|
+
this.otherDeviceType = this.accessory.context.deviceType = this.device?.other?.deviceType;
|
|
71
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
72
|
+
this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
|
|
54
76
|
}
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
logs() {
|
|
58
80
|
if (this.platform.debugMode) {
|
|
59
81
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
60
|
-
|
|
61
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
62
|
-
}
|
|
82
|
+
this.warnLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
63
83
|
} else if (this.device.logging) {
|
|
64
84
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
65
|
-
if (this.
|
|
85
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
66
86
|
this.warnLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
67
87
|
}
|
|
68
88
|
} else if (this.platform.config.options?.logging) {
|
|
69
89
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
70
|
-
if (this.
|
|
90
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
71
91
|
this.warnLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
72
92
|
}
|
|
73
93
|
} else {
|
|
74
94
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
75
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
76
|
-
this.warnLog(`Other: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
77
|
-
}
|
|
78
95
|
}
|
|
79
96
|
}
|
|
80
97
|
|
package/src/irdevices/tvs.ts
CHANGED
|
@@ -131,24 +131,19 @@ export class TV {
|
|
|
131
131
|
logs() {
|
|
132
132
|
if (this.platform.debugMode) {
|
|
133
133
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
134
|
-
|
|
135
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
136
|
-
}
|
|
134
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
137
135
|
} else if (this.device.logging) {
|
|
138
136
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
139
|
-
if (this.
|
|
137
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
140
138
|
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
141
139
|
}
|
|
142
140
|
} else if (this.platform.config.options?.logging) {
|
|
143
141
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
144
|
-
if (this.
|
|
142
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
145
143
|
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
146
144
|
}
|
|
147
145
|
} else {
|
|
148
146
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
149
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
150
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
151
|
-
}
|
|
152
147
|
}
|
|
153
148
|
}
|
|
154
149
|
|
|
@@ -60,24 +60,19 @@ export class VacuumCleaner {
|
|
|
60
60
|
logs() {
|
|
61
61
|
if (this.platform.debugMode) {
|
|
62
62
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
63
|
-
|
|
64
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
65
|
-
}
|
|
63
|
+
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
66
64
|
} else if (this.device.logging) {
|
|
67
65
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
68
|
-
if (this.
|
|
66
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
69
67
|
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
70
68
|
}
|
|
71
69
|
} else if (this.platform.config.options?.logging) {
|
|
72
70
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
73
|
-
if (this.
|
|
71
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
74
72
|
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
75
73
|
}
|
|
76
74
|
} else {
|
|
77
75
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
78
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
79
|
-
this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
80
|
-
}
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
|
|
@@ -69,24 +69,19 @@ export class WaterHeater {
|
|
|
69
69
|
logs() {
|
|
70
70
|
if (this.platform.debugMode) {
|
|
71
71
|
this.deviceLogging = this.accessory.context.logging = 'debug';
|
|
72
|
-
|
|
73
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
74
|
-
}
|
|
72
|
+
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
75
73
|
} else if (this.device.logging) {
|
|
76
74
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
77
|
-
if (this.
|
|
75
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
78
76
|
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
79
77
|
}
|
|
80
78
|
} else if (this.platform.config.options?.logging) {
|
|
81
79
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
82
|
-
if (this.
|
|
80
|
+
if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
|
|
83
81
|
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
84
82
|
}
|
|
85
83
|
} else {
|
|
86
84
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
87
|
-
if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
|
|
88
|
-
this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Standard Logging`);
|
|
89
|
-
}
|
|
90
85
|
}
|
|
91
86
|
}
|
|
92
87
|
|
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
|
}
|