@switchbot/homebridge-switchbot 2.0.0-beta.2 → 2.0.0-beta.21
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 +8 -1
- package/README.md +1 -2
- package/config.schema.json +75 -20
- package/dist/device/bot.d.ts +32 -28
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +646 -648
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +34 -19
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +429 -304
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +16 -7
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +288 -230
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +21 -16
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +519 -489
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +22 -18
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +415 -360
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +22 -8
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +253 -147
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +21 -16
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +325 -255
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +23 -12
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +346 -208
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +17 -8
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +261 -209
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +24 -16
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +267 -242
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +51 -16
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +527 -185
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -12
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +261 -230
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -3
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +137 -104
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +9 -8
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +116 -86
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +8 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +143 -109
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +9 -8
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +120 -103
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +9 -8
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +128 -98
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +10 -9
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +126 -93
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +7 -10
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +115 -89
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -9
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +115 -89
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +5 -5
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +227 -199
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +15 -11
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +12 -10
- package/src/device/bot.ts +641 -657
- package/src/device/colorbulb.ts +440 -339
- package/src/device/contact.ts +289 -233
- package/src/device/curtain.ts +523 -503
- package/src/device/humidifier.ts +421 -396
- package/src/device/lock.ts +257 -147
- package/src/device/meter.ts +335 -268
- package/src/device/meterplus.ts +354 -213
- package/src/device/motion.ts +264 -213
- package/src/device/plug.ts +270 -251
- package/src/device/striplight.ts +552 -207
- package/src/irdevice/airconditioner.ts +263 -241
- package/src/irdevice/airpurifier.ts +132 -103
- package/src/irdevice/camera.ts +112 -85
- package/src/irdevice/fan.ts +138 -106
- package/src/irdevice/light.ts +116 -103
- package/src/irdevice/other.ts +124 -97
- package/src/irdevice/tv.ts +123 -93
- package/src/irdevice/vacuumcleaner.ts +112 -89
- package/src/irdevice/waterheater.ts +111 -89
- package/src/platform.ts +216 -214
- package/src/settings.ts +15 -11
package/src/irdevice/light.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import crypto from 'crypto';
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
|
+
import superStringify from 'super-stringify';
|
|
4
5
|
import { SwitchBotPlatform } from '../platform';
|
|
5
6
|
import { irDevicesConfig, irdevice, HostDomain, DevicePath } from '../settings';
|
|
6
7
|
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
@@ -16,7 +17,6 @@ export class Light {
|
|
|
16
17
|
|
|
17
18
|
// Characteristic Values
|
|
18
19
|
On!: CharacteristicValue;
|
|
19
|
-
OnCached!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
22
|
deviceLogging!: string;
|
|
@@ -25,23 +25,22 @@ export class Light {
|
|
|
25
25
|
// default placeholders
|
|
26
26
|
this.logs(device);
|
|
27
27
|
this.config(device);
|
|
28
|
-
|
|
29
|
-
this.On = false;
|
|
30
|
-
} else {
|
|
31
|
-
this.On = this.accessory.context.On;
|
|
32
|
-
}
|
|
28
|
+
this.context();
|
|
33
29
|
|
|
34
30
|
// set accessory information
|
|
35
31
|
accessory
|
|
36
32
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
37
33
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
38
34
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
39
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
35
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
36
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
|
|
37
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
38
|
+
.updateValue(this.FirmwareRevision(accessory, device));
|
|
40
39
|
|
|
41
40
|
// get the Television service if it exists, otherwise create a new Television service
|
|
42
41
|
// you can create multiple services for each accessory
|
|
43
42
|
(this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
|
|
44
|
-
`${accessory.displayName}
|
|
43
|
+
`${accessory.displayName} ${device.remoteType}`;
|
|
45
44
|
|
|
46
45
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
47
46
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -53,26 +52,12 @@ export class Light {
|
|
|
53
52
|
|
|
54
53
|
// handle on / off events using the On characteristic
|
|
55
54
|
this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
56
|
-
|
|
57
|
-
// handle Brightness events using the Brightness characteristic
|
|
58
|
-
/* this.service
|
|
59
|
-
.getCharacteristic(this.platform.Characteristic.Brightness)
|
|
60
|
-
.on(CharacteristicEventTypes.SET, (value: any, callback: CharacteristicGetCallback) => {
|
|
61
|
-
this.debugLog(`${this.device.remoteType} ${this.accessory.displayName} Set Brightness: ${value}`);
|
|
62
|
-
this.Brightness = value;
|
|
63
|
-
if (value > this.Brightness) {
|
|
64
|
-
this.pushLightBrightnessUpChanges();
|
|
65
|
-
} else {
|
|
66
|
-
this.pushLightBrightnessDownChanges();
|
|
67
|
-
}
|
|
68
|
-
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.Brightness);
|
|
69
|
-
callback(null);
|
|
70
|
-
});*/
|
|
71
55
|
}
|
|
72
56
|
|
|
73
57
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
74
|
-
this.debugLog(
|
|
58
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
|
|
75
59
|
this.On = value;
|
|
60
|
+
this.accessory.context.On = this.On;
|
|
76
61
|
if (this.On) {
|
|
77
62
|
await this.pushLightOnChanges();
|
|
78
63
|
} else {
|
|
@@ -80,28 +65,19 @@ export class Light {
|
|
|
80
65
|
}
|
|
81
66
|
}
|
|
82
67
|
|
|
83
|
-
async updateHomeKitCharacteristics(): Promise<void> {
|
|
84
|
-
if (this.On === undefined) {
|
|
85
|
-
this.debugLog(`Light: ${this.accessory.displayName} On: ${this.On}`);
|
|
86
|
-
} else {
|
|
87
|
-
this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
88
|
-
this.debugLog(`Light: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
68
|
/**
|
|
93
69
|
* Pushes the requested changes to the SwitchBot API
|
|
94
70
|
* deviceType commandType Command command parameter Description
|
|
95
|
-
* Light
|
|
96
|
-
* Light
|
|
97
|
-
* Light
|
|
98
|
-
* Light
|
|
99
|
-
* Light
|
|
100
|
-
* Light
|
|
71
|
+
* Light - "command" "turnOff" "default" = set to OFF state
|
|
72
|
+
* Light - "command" "turnOn" "default" = set to ON state
|
|
73
|
+
* Light - "command" "volumeAdd" "default" = volume up
|
|
74
|
+
* Light - "command" "volumeSub" "default" = volume down
|
|
75
|
+
* Light - "command" "channelAdd" "default" = next channel
|
|
76
|
+
* Light - "command" "channelSub" "default" = previous channel
|
|
101
77
|
*/
|
|
102
78
|
async pushLightOnChanges(): Promise<void> {
|
|
103
79
|
if (this.On) {
|
|
104
|
-
const body =
|
|
80
|
+
const body = superStringify({
|
|
105
81
|
'command': 'turnOn',
|
|
106
82
|
'parameter': 'default',
|
|
107
83
|
'commandType': 'command',
|
|
@@ -112,7 +88,7 @@ export class Light {
|
|
|
112
88
|
|
|
113
89
|
async pushLightOffChanges(): Promise<void> {
|
|
114
90
|
if (!this.On) {
|
|
115
|
-
const body =
|
|
91
|
+
const body = superStringify({
|
|
116
92
|
'command': 'turnOff',
|
|
117
93
|
'parameter': 'default',
|
|
118
94
|
'commandType': 'command',
|
|
@@ -122,7 +98,7 @@ export class Light {
|
|
|
122
98
|
}
|
|
123
99
|
|
|
124
100
|
async pushLightBrightnessUpChanges(): Promise<void> {
|
|
125
|
-
const body =
|
|
101
|
+
const body = superStringify({
|
|
126
102
|
'command': 'brightnessUp',
|
|
127
103
|
'parameter': 'default',
|
|
128
104
|
'commandType': 'command',
|
|
@@ -131,7 +107,7 @@ export class Light {
|
|
|
131
107
|
}
|
|
132
108
|
|
|
133
109
|
async pushLightBrightnessDownChanges(): Promise<void> {
|
|
134
|
-
const body =
|
|
110
|
+
const body = superStringify({
|
|
135
111
|
'command': 'brightnessDown',
|
|
136
112
|
'parameter': 'default',
|
|
137
113
|
'commandType': 'command',
|
|
@@ -140,92 +116,126 @@ export class Light {
|
|
|
140
116
|
}
|
|
141
117
|
|
|
142
118
|
async pushChanges(body): Promise<void> {
|
|
143
|
-
|
|
119
|
+
if (this.device.connectionType === 'OpenAPI') {
|
|
120
|
+
try {
|
|
144
121
|
// Make Push On request to the API
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
122
|
+
const t = Date.now();
|
|
123
|
+
const nonce = 'requestID';
|
|
124
|
+
const data = this.platform.config.credentials?.token + t + nonce;
|
|
125
|
+
const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
|
|
126
|
+
.update(Buffer.from(data, 'utf-8'))
|
|
127
|
+
.digest();
|
|
128
|
+
const sign = signTerm.toString('base64');
|
|
129
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
|
|
130
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
|
|
131
|
+
const options = {
|
|
132
|
+
hostname: HostDomain,
|
|
133
|
+
port: 443,
|
|
134
|
+
path: `${DevicePath}/${this.device.deviceId}/commands`,
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: {
|
|
137
|
+
'Authorization': this.platform.config.credentials?.token,
|
|
138
|
+
'sign': sign,
|
|
139
|
+
'nonce': nonce,
|
|
140
|
+
't': t,
|
|
141
|
+
'Content-Type': 'application/json',
|
|
142
|
+
'Content-Length': body.length,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
const req = https.request(options, res => {
|
|
146
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
|
|
147
|
+
this.statusCode({ res });
|
|
148
|
+
res.on('data', d => {
|
|
149
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
|
|
150
|
+
});
|
|
173
151
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (this.deviceLogging.includes('debug')) {
|
|
187
|
-
this.errorLog(
|
|
188
|
-
`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
|
|
152
|
+
req.on('error', (e: any) => {
|
|
153
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
|
|
154
|
+
});
|
|
155
|
+
req.write(body);
|
|
156
|
+
req.end();
|
|
157
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
|
|
158
|
+
this.accessory.context.On = this.On;
|
|
159
|
+
this.updateHomeKitCharacteristics();
|
|
160
|
+
} catch (e: any) {
|
|
161
|
+
this.apiError(e);
|
|
162
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
|
|
163
|
+
+ ` Error Message: ${superStringify(e.message)}`,
|
|
189
164
|
);
|
|
190
165
|
}
|
|
191
|
-
|
|
166
|
+
} else {
|
|
167
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
168
|
+
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async updateHomeKitCharacteristics(): Promise<void> {
|
|
173
|
+
if (this.On === undefined) {
|
|
174
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
175
|
+
} else {
|
|
176
|
+
this.accessory.context.On = this.On;
|
|
177
|
+
this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
178
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
192
179
|
}
|
|
193
180
|
}
|
|
194
181
|
|
|
195
182
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
196
183
|
switch (res.statusCode) {
|
|
197
184
|
case 151:
|
|
198
|
-
this.errorLog(
|
|
185
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
199
186
|
break;
|
|
200
187
|
case 152:
|
|
201
|
-
this.errorLog(
|
|
188
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found.`);
|
|
202
189
|
break;
|
|
203
190
|
case 160:
|
|
204
|
-
this.errorLog(
|
|
191
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported.`);
|
|
205
192
|
break;
|
|
206
193
|
case 161:
|
|
207
|
-
this.errorLog(
|
|
194
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline.`);
|
|
208
195
|
break;
|
|
209
196
|
case 171:
|
|
210
|
-
this.errorLog(
|
|
197
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
211
198
|
break;
|
|
212
199
|
case 190:
|
|
213
200
|
this.errorLog(
|
|
214
|
-
|
|
215
|
-
` with server, Or command: ${
|
|
201
|
+
`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
|
|
202
|
+
` with server, Or command: ${superStringify(res)} format is invalid`,
|
|
216
203
|
);
|
|
217
204
|
break;
|
|
218
205
|
case 100:
|
|
219
|
-
this.debugLog(
|
|
206
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent.`);
|
|
220
207
|
break;
|
|
221
208
|
default:
|
|
222
|
-
this.debugLog(
|
|
209
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode.`);
|
|
223
210
|
}
|
|
224
211
|
}
|
|
225
212
|
|
|
226
213
|
async apiError(e: any): Promise<void> {
|
|
227
214
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
228
|
-
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
218
|
+
let FirmwareRevision: string;
|
|
219
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
220
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
221
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
222
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
223
|
+
if (accessory.context.FirmwareRevision) {
|
|
224
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
225
|
+
} else if (device.firmware) {
|
|
226
|
+
FirmwareRevision = device.firmware;
|
|
227
|
+
} else {
|
|
228
|
+
FirmwareRevision = this.platform.version;
|
|
229
|
+
}
|
|
230
|
+
return FirmwareRevision;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async context() {
|
|
234
|
+
if (this.On === undefined) {
|
|
235
|
+
this.On = false;
|
|
236
|
+
} else {
|
|
237
|
+
this.On = this.accessory.context.On;
|
|
238
|
+
}
|
|
229
239
|
}
|
|
230
240
|
|
|
231
241
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -236,24 +246,27 @@ export class Light {
|
|
|
236
246
|
if (device.logging !== undefined) {
|
|
237
247
|
config['logging'] = device.logging;
|
|
238
248
|
}
|
|
249
|
+
if (device.connectionType !== undefined) {
|
|
250
|
+
config['connectionType'] = device.connectionType;
|
|
251
|
+
}
|
|
239
252
|
if (Object.entries(config).length !== 0) {
|
|
240
|
-
this.infoLog(
|
|
253
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
241
254
|
}
|
|
242
255
|
}
|
|
243
256
|
|
|
244
257
|
async logs(device: irdevice & irDevicesConfig): Promise<void> {
|
|
245
258
|
if (this.platform.debugMode) {
|
|
246
259
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
247
|
-
this.debugLog(
|
|
260
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
248
261
|
} else if (device.logging) {
|
|
249
262
|
this.deviceLogging = this.accessory.context.logging = device.logging;
|
|
250
|
-
this.debugLog(
|
|
263
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
251
264
|
} else if (this.platform.config.options?.logging) {
|
|
252
265
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
253
|
-
this.debugLog(
|
|
266
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
254
267
|
} else {
|
|
255
268
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
256
|
-
this.debugLog(
|
|
269
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
257
270
|
}
|
|
258
271
|
}
|
|
259
272
|
|