@switchbot/homebridge-switchbot 1.8.3-beta.0 → 1.10.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/.eslintrc +14 -45
- package/.github/ISSUE_TEMPLATE/bug-report.yml +3 -3
- package/.github/ISSUE_TEMPLATE/feature-request.yml +2 -2
- package/.github/ISSUE_TEMPLATE/support-request.yml +3 -3
- package/.github/labeler.yml +1 -1
- package/.github/workflows/codeql-analysis.yml +29 -29
- package/.github/workflows/nodejs-beta.yml +1 -1
- package/.github/workflows/prerelease-beta.js +1 -1
- package/.github/workflows/stale.yml +1 -1
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +2 -4
- package/.vscode/settings.json +14 -2
- package/CHANGELOG.md +16 -0
- package/README.md +100 -99
- package/SECURITY.md +2 -2
- package/config.schema.json +17 -0
- package/dist/devices/bots.d.ts +35 -32
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +168 -210
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +35 -35
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +83 -108
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +27 -25
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +110 -131
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +29 -27
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +147 -182
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +31 -31
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +154 -181
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +29 -28
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +98 -120
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +24 -23
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +97 -113
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +16 -16
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +48 -71
- package/dist/devices/plugs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -22
- package/dist/index.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +7 -4
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +72 -93
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +3 -3
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +32 -51
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +3 -3
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +19 -26
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +3 -3
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +35 -44
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +3 -3
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +25 -32
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +3 -3
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +21 -29
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +3 -3
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +66 -89
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +3 -3
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +18 -24
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +3 -3
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +19 -26
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +10 -10
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +163 -233
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +3 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +4 -4
- package/dist/settings.js.map +1 -1
- package/homebridge-ui/public/index.html +231 -245
- package/homebridge-ui/server.js +2 -4
- package/nodemon.json +2 -4
- package/package.json +17 -12
- package/src/devices/bots.ts +411 -854
- package/src/devices/colorbulb.ts +187 -408
- package/src/devices/contact.ts +210 -376
- package/src/devices/curtains.ts +288 -563
- package/src/devices/humidifiers.ts +291 -537
- package/src/devices/meters.ts +189 -331
- package/src/devices/motion.ts +188 -322
- package/src/devices/plugs.ts +88 -160
- package/src/index.ts +5 -5
- package/src/irdevices/airconditioners.ts +139 -318
- package/src/irdevices/airpurifiers.ts +71 -170
- package/src/irdevices/cameras.ts +44 -103
- package/src/irdevices/fans.ts +70 -165
- package/src/irdevices/lights.ts +49 -104
- package/src/irdevices/others.ts +55 -131
- package/src/irdevices/tvs.ts +114 -247
- package/src/irdevices/vacuumcleaners.ts +44 -104
- package/src/irdevices/waterheaters.ts +49 -121
- package/src/platform.ts +341 -753
- package/src/settings.ts +8 -11
- package/tsconfig.json +5 -14
- package/.github/PULL_REQUEST_TEMPLATE/pull_requests.md +0 -27
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
3
|
exports.Humidifier = void 0;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const settings_1 = require("../settings");
|
|
26
7
|
/**
|
|
27
8
|
* Platform Accessory
|
|
28
9
|
* An instance of this class is created for each accessory your platform registers
|
|
@@ -39,30 +20,30 @@ class Humidifier {
|
|
|
39
20
|
this.refreshRate(device);
|
|
40
21
|
this.config(device);
|
|
41
22
|
this.CurrentRelativeHumidity = 0;
|
|
42
|
-
this.TargetHumidifierDehumidifierState =
|
|
43
|
-
|
|
44
|
-
this.CurrentHumidifierDehumidifierState =
|
|
45
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
|
|
23
|
+
this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
|
|
24
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
|
|
46
25
|
this.Active = this.platform.Characteristic.Active.ACTIVE;
|
|
47
26
|
this.RelativeHumidityHumidifierThreshold = 0;
|
|
48
27
|
this.CurrentTemperature = 0;
|
|
49
28
|
this.WaterLevel = 0;
|
|
29
|
+
// Humidifiers Config
|
|
30
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} Config: (ble: ${device.ble}, offline: ${device.offline}, hide_temperature: ` +
|
|
31
|
+
`${device.humidifier?.hide_temperature}, set_minStep: ${device.humidifier?.set_minStep})`);
|
|
50
32
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
51
|
-
this.doHumidifierUpdate = new
|
|
33
|
+
this.doHumidifierUpdate = new rxjs_1.Subject();
|
|
52
34
|
this.humidifierUpdateInProgress = false;
|
|
53
35
|
// Retrieve initial values and updateHomekit
|
|
54
36
|
this.refreshStatus();
|
|
55
37
|
// set accessory information
|
|
56
38
|
accessory
|
|
57
39
|
.getService(this.platform.Service.AccessoryInformation)
|
|
58
|
-
.setCharacteristic(this.platform.Characteristic.Manufacturer,
|
|
59
|
-
.setCharacteristic(this.platform.Characteristic.Model,
|
|
40
|
+
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-HUMIDIFIER-W0801800')
|
|
60
42
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId);
|
|
61
43
|
// get the LightBulb service if it exists, otherwise create a new LightBulb service
|
|
62
44
|
// you can create multiple services for each accessory
|
|
63
45
|
(this.service =
|
|
64
|
-
accessory.getService(this.platform.Service.HumidifierDehumidifier) ||
|
|
65
|
-
accessory.addService(this.platform.Service.HumidifierDehumidifier)),
|
|
46
|
+
accessory.getService(this.platform.Service.HumidifierDehumidifier) || accessory.addService(this.platform.Service.HumidifierDehumidifier)),
|
|
66
47
|
`${accessory.displayName} Humidifier`;
|
|
67
48
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
68
49
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -83,9 +64,7 @@ class Humidifier {
|
|
|
83
64
|
validValues: [0, 1],
|
|
84
65
|
})
|
|
85
66
|
.onSet(this.handleTargetHumidifierDehumidifierStateSet.bind(this));
|
|
86
|
-
this.service
|
|
87
|
-
.getCharacteristic(this.platform.Characteristic.Active)
|
|
88
|
-
.onSet(this.handleActiveSet.bind(this));
|
|
67
|
+
this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.handleActiveSet.bind(this));
|
|
89
68
|
this.service
|
|
90
69
|
.getCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold)
|
|
91
70
|
.setProps({
|
|
@@ -105,8 +84,7 @@ class Humidifier {
|
|
|
105
84
|
else if (!this.temperatureservice && !device.ble) {
|
|
106
85
|
this.debugLog(`Humidifier: ${accessory.displayName} Add Temperature Sensor Service`);
|
|
107
86
|
(this.temperatureservice =
|
|
108
|
-
this.accessory.getService(this.platform.Service.TemperatureSensor) ||
|
|
109
|
-
this.accessory.addService(this.platform.Service.TemperatureSensor)),
|
|
87
|
+
this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)),
|
|
110
88
|
`${accessory.displayName} Temperature Sensor`;
|
|
111
89
|
this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
112
90
|
this.temperatureservice
|
|
@@ -127,27 +105,28 @@ class Humidifier {
|
|
|
127
105
|
// Retrieve initial values and updateHomekit
|
|
128
106
|
this.updateHomeKitCharacteristics();
|
|
129
107
|
// Start an update interval
|
|
130
|
-
|
|
131
|
-
.
|
|
132
|
-
.pipe(operators.skipWhile(() => this.humidifierUpdateInProgress))
|
|
108
|
+
(0, rxjs_1.interval)(this.deviceRefreshRate * 1000)
|
|
109
|
+
.pipe((0, operators_1.skipWhile)(() => this.humidifierUpdateInProgress))
|
|
133
110
|
.subscribe(() => {
|
|
134
111
|
this.refreshStatus();
|
|
135
112
|
});
|
|
136
113
|
// Watch for Humidifier change events
|
|
137
114
|
// We put in a debounce of 100ms so we don't make duplicate calls
|
|
138
115
|
this.doHumidifierUpdate
|
|
139
|
-
.pipe(
|
|
116
|
+
.pipe((0, operators_1.tap)(() => {
|
|
140
117
|
this.humidifierUpdateInProgress = true;
|
|
141
|
-
}),
|
|
118
|
+
}), (0, operators_1.debounceTime)(this.platform.config.options.pushRate * 1000))
|
|
142
119
|
.subscribe(async () => {
|
|
143
120
|
try {
|
|
144
121
|
await this.pushChanges();
|
|
145
122
|
}
|
|
146
123
|
catch (e) {
|
|
147
124
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges`);
|
|
148
|
-
if (this.deviceLogging
|
|
149
|
-
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,` +
|
|
150
|
-
|
|
125
|
+
if (this.deviceLogging === 'debug') {
|
|
126
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
|
|
127
|
+
}
|
|
128
|
+
if (this.platform.debugMode) {
|
|
129
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
|
|
151
130
|
}
|
|
152
131
|
this.apiError(e);
|
|
153
132
|
}
|
|
@@ -193,44 +172,34 @@ class Humidifier {
|
|
|
193
172
|
// Target Humidifier Dehumidifier State
|
|
194
173
|
switch (this.auto) {
|
|
195
174
|
case true:
|
|
196
|
-
this.TargetHumidifierDehumidifierState =
|
|
197
|
-
|
|
198
|
-
this.
|
|
199
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
|
|
200
|
-
this.RelativeHumidityHumidifierThreshold =
|
|
201
|
-
this.CurrentRelativeHumidity;
|
|
175
|
+
this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER;
|
|
176
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
|
|
177
|
+
this.RelativeHumidityHumidifierThreshold = this.CurrentRelativeHumidity;
|
|
202
178
|
break;
|
|
203
179
|
default:
|
|
204
|
-
this.TargetHumidifierDehumidifierState =
|
|
205
|
-
this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
|
|
180
|
+
this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
|
|
206
181
|
if (this.nebulizationEfficiency > 100) {
|
|
207
182
|
this.RelativeHumidityHumidifierThreshold = 100;
|
|
208
183
|
}
|
|
209
184
|
else {
|
|
210
|
-
this.RelativeHumidityHumidifierThreshold =
|
|
211
|
-
this.nebulizationEfficiency;
|
|
185
|
+
this.RelativeHumidityHumidifierThreshold = this.nebulizationEfficiency;
|
|
212
186
|
}
|
|
213
|
-
if (this.CurrentRelativeHumidity >
|
|
214
|
-
this.
|
|
215
|
-
this.CurrentHumidifierDehumidifierState =
|
|
216
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
|
|
187
|
+
if (this.CurrentRelativeHumidity > this.RelativeHumidityHumidifierThreshold) {
|
|
188
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
|
|
217
189
|
}
|
|
218
190
|
else if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
|
|
219
|
-
this.CurrentHumidifierDehumidifierState =
|
|
220
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
|
|
191
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
|
|
221
192
|
}
|
|
222
193
|
else {
|
|
223
|
-
this.CurrentHumidifierDehumidifierState =
|
|
224
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
|
|
194
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
|
|
225
195
|
}
|
|
226
196
|
}
|
|
227
197
|
this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
|
|
228
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName}` +
|
|
229
|
-
` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
|
|
198
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
|
|
230
199
|
this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
|
|
231
200
|
// Active
|
|
232
201
|
switch (this.power) {
|
|
233
|
-
case
|
|
202
|
+
case 'on':
|
|
234
203
|
this.Active = this.platform.Characteristic.Active.ACTIVE;
|
|
235
204
|
break;
|
|
236
205
|
default:
|
|
@@ -264,82 +233,88 @@ class Humidifier {
|
|
|
264
233
|
// Convert to BLE Address
|
|
265
234
|
this.device.bleMac = this.device
|
|
266
235
|
.deviceId.match(/.{1,2}/g)
|
|
267
|
-
.join(
|
|
236
|
+
.join(':')
|
|
268
237
|
.toLowerCase();
|
|
269
|
-
this.debugLog(`
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// Start to monitor advertisement packets
|
|
276
|
-
await switchbot.startScan({
|
|
277
|
-
model: "e",
|
|
238
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
239
|
+
// Start to monitor advertisement packets
|
|
240
|
+
if (switchbot !== false) {
|
|
241
|
+
switchbot
|
|
242
|
+
.startScan({
|
|
243
|
+
model: 'e',
|
|
278
244
|
id: this.device.bleMac,
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
`
|
|
289
|
-
|
|
290
|
-
this.
|
|
291
|
-
|
|
245
|
+
})
|
|
246
|
+
.then(() => {
|
|
247
|
+
// Set an event hander
|
|
248
|
+
switchbot.onadvertisement = (ad) => {
|
|
249
|
+
this.serviceData = ad.serviceData;
|
|
250
|
+
this.autoMode = ad.serviceData.autoMode;
|
|
251
|
+
this.onState = ad.serviceData.onState;
|
|
252
|
+
this.percentage = ad.serviceData.percentage;
|
|
253
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
254
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName},` +
|
|
255
|
+
`autoMode: ${ad.serviceData.autoMode}, onState: ${ad.serviceData.onState}, percentage: ${ad.serviceData.percentage}`);
|
|
256
|
+
if (this.serviceData) {
|
|
257
|
+
this.connected = true;
|
|
258
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
this.connected = false;
|
|
262
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
// Wait 2 seconds
|
|
266
|
+
return switchbot.wait(this.scanDuration * 1000);
|
|
267
|
+
})
|
|
268
|
+
.then(async () => {
|
|
269
|
+
// Stop to monitor
|
|
270
|
+
switchbot.stopScan();
|
|
271
|
+
if (this.connected) {
|
|
272
|
+
this.parseStatus();
|
|
273
|
+
this.updateHomeKitCharacteristics();
|
|
292
274
|
}
|
|
293
275
|
else {
|
|
294
|
-
this.
|
|
295
|
-
|
|
276
|
+
await this.BLEconnection(switchbot);
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
.catch(async (e) => {
|
|
280
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
|
|
281
|
+
if (this.deviceLogging === 'debug') {
|
|
282
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
|
|
283
|
+
}
|
|
284
|
+
if (this.platform.debugMode) {
|
|
285
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
296
286
|
}
|
|
297
|
-
};
|
|
298
|
-
// Wait 2 seconds
|
|
299
|
-
await switchbot.wait(this.scanDuration * 1000);
|
|
300
|
-
// Stop to monitor
|
|
301
|
-
switchbot.stopScan();
|
|
302
|
-
if (this.connected) {
|
|
303
|
-
this.parseStatus();
|
|
304
|
-
this.updateHomeKitCharacteristics();
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
|
|
308
287
|
if (this.platform.config.credentials?.openToken) {
|
|
309
288
|
this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
310
|
-
this.SwitchToOpenAPI = true;
|
|
311
289
|
await this.openAPIRefreshStatus();
|
|
312
290
|
}
|
|
313
|
-
|
|
291
|
+
this.apiError(e);
|
|
292
|
+
});
|
|
314
293
|
}
|
|
315
|
-
|
|
316
|
-
this.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
await this.openAPIRefreshStatus();
|
|
325
|
-
}
|
|
326
|
-
this.apiError(e);
|
|
294
|
+
else {
|
|
295
|
+
await this.BLEconnection(switchbot);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
async BLEconnection(switchbot) {
|
|
299
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
300
|
+
if (this.platform.config.credentials?.openToken) {
|
|
301
|
+
this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
302
|
+
await this.openAPIRefreshStatus();
|
|
327
303
|
}
|
|
328
304
|
}
|
|
329
305
|
async openAPIRefreshStatus() {
|
|
330
306
|
if (this.platform.config.credentials?.openToken) {
|
|
331
307
|
this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI refreshStatus`);
|
|
332
308
|
try {
|
|
333
|
-
this.deviceStatus = (await this.platform.axios.get(`${
|
|
334
|
-
if (this.deviceStatus.message ===
|
|
309
|
+
this.deviceStatus = (await this.platform.axios.get(`${settings_1.DeviceURL}/${this.device.deviceId}/status`)).data;
|
|
310
|
+
if (this.deviceStatus.message === 'success') {
|
|
335
311
|
this.debugLog(`Humidifier: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
|
|
336
312
|
this.auto = this.deviceStatus.body.auto;
|
|
337
313
|
this.power = this.deviceStatus.body.power;
|
|
338
314
|
this.lackWater = this.deviceStatus.body.lackWater;
|
|
339
315
|
this.humidity = this.deviceStatus.body.humidity;
|
|
340
316
|
this.temperature = this.deviceStatus.body.temperature;
|
|
341
|
-
this.nebulizationEfficiency =
|
|
342
|
-
this.deviceStatus.body.nebulizationEfficiency;
|
|
317
|
+
this.nebulizationEfficiency = this.deviceStatus.body.nebulizationEfficiency;
|
|
343
318
|
this.parseStatus();
|
|
344
319
|
this.updateHomeKitCharacteristics();
|
|
345
320
|
}
|
|
@@ -349,10 +324,13 @@ class Humidifier {
|
|
|
349
324
|
}
|
|
350
325
|
catch (e) {
|
|
351
326
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
|
|
352
|
-
if (this.deviceLogging
|
|
327
|
+
if (this.deviceLogging === 'debug') {
|
|
353
328
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
|
|
354
329
|
` Error Message: ${JSON.stringify(e.message)}`);
|
|
355
330
|
}
|
|
331
|
+
if (this.platform.debugMode) {
|
|
332
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
333
|
+
}
|
|
356
334
|
this.apiError(e);
|
|
357
335
|
}
|
|
358
336
|
}
|
|
@@ -366,10 +344,9 @@ class Humidifier {
|
|
|
366
344
|
//} else {
|
|
367
345
|
await this.openAPIpushChanges();
|
|
368
346
|
//}
|
|
369
|
-
|
|
370
|
-
.
|
|
371
|
-
.pipe(
|
|
372
|
-
.pipe(operators.take(1))
|
|
347
|
+
(0, rxjs_1.interval)(5000)
|
|
348
|
+
.pipe((0, operators_1.skipWhile)(() => this.humidifierUpdateInProgress))
|
|
349
|
+
.pipe((0, operators_1.take)(1))
|
|
373
350
|
.subscribe(() => {
|
|
374
351
|
this.refreshStatus();
|
|
375
352
|
});
|
|
@@ -380,12 +357,12 @@ class Humidifier {
|
|
|
380
357
|
// Convert to BLE Address
|
|
381
358
|
this.device.bleMac = this.device
|
|
382
359
|
.deviceId.match(/.{1,2}/g)
|
|
383
|
-
.join(
|
|
360
|
+
.join(':')
|
|
384
361
|
.toLowerCase();
|
|
385
|
-
this.debugLog(`
|
|
362
|
+
this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
|
|
386
363
|
if (switchbot !== false) {
|
|
387
364
|
switchbot
|
|
388
|
-
.discover({ model:
|
|
365
|
+
.discover({ model: 'e', quick: true, id: this.device.bleMac })
|
|
389
366
|
.then((device_list) => {
|
|
390
367
|
this.infoLog(`${this.accessory.displayName} Target Position: ${this.Active}`);
|
|
391
368
|
return device_list[0].percentage(this.RelativeHumidityHumidifierThreshold);
|
|
@@ -395,9 +372,11 @@ class Humidifier {
|
|
|
395
372
|
})
|
|
396
373
|
.catch(async (e) => {
|
|
397
374
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
|
|
398
|
-
if (this.deviceLogging
|
|
399
|
-
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,` +
|
|
400
|
-
|
|
375
|
+
if (this.deviceLogging === 'debug') {
|
|
376
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,` + ` Error Message: ${JSON.stringify(e.message)}`);
|
|
377
|
+
}
|
|
378
|
+
if (this.platform.debugMode) {
|
|
379
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
401
380
|
}
|
|
402
381
|
if (this.platform.config.credentials?.openToken) {
|
|
403
382
|
this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
@@ -417,36 +396,35 @@ class Humidifier {
|
|
|
417
396
|
async openAPIpushChanges() {
|
|
418
397
|
if (this.platform.config.credentials?.openToken) {
|
|
419
398
|
this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI pushChanges`);
|
|
420
|
-
if (this.TargetHumidifierDehumidifierState ===
|
|
421
|
-
this.platform.Characteristic.TargetHumidifierDehumidifierState
|
|
422
|
-
.HUMIDIFIER &&
|
|
399
|
+
if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER &&
|
|
423
400
|
this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
424
401
|
try {
|
|
425
402
|
this.debugLog(`Pushing Manual: ${this.RelativeHumidityHumidifierThreshold}!`);
|
|
426
403
|
const payload = {
|
|
427
|
-
commandType:
|
|
428
|
-
command:
|
|
404
|
+
commandType: 'command',
|
|
405
|
+
command: 'setMode',
|
|
429
406
|
parameter: `${this.RelativeHumidityHumidifierThreshold}`,
|
|
430
407
|
};
|
|
431
408
|
this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
432
409
|
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
433
410
|
// Make the API request
|
|
434
|
-
const push = await this.platform.axios.post(`${
|
|
411
|
+
const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
435
412
|
this.debugLog(`Humidifier: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
|
|
436
413
|
this.statusCode(push);
|
|
437
414
|
}
|
|
438
415
|
catch (e) {
|
|
439
416
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
440
|
-
if (this.deviceLogging
|
|
417
|
+
if (this.deviceLogging === 'debug') {
|
|
441
418
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
|
|
442
419
|
` Error Message: ${JSON.stringify(e.message)}`);
|
|
443
420
|
}
|
|
421
|
+
if (this.platform.debugMode) {
|
|
422
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
423
|
+
}
|
|
444
424
|
this.apiError(e);
|
|
445
425
|
}
|
|
446
426
|
}
|
|
447
|
-
else if (this.TargetHumidifierDehumidifierState ===
|
|
448
|
-
this.platform.Characteristic.TargetHumidifierDehumidifierState
|
|
449
|
-
.HUMIDIFIER_OR_DEHUMIDIFIER &&
|
|
427
|
+
else if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
|
|
450
428
|
this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
451
429
|
await this.pushAutoChanges();
|
|
452
430
|
}
|
|
@@ -460,30 +438,31 @@ class Humidifier {
|
|
|
460
438
|
*/
|
|
461
439
|
async pushAutoChanges() {
|
|
462
440
|
try {
|
|
463
|
-
if (this.TargetHumidifierDehumidifierState ===
|
|
464
|
-
this.platform.Characteristic.TargetHumidifierDehumidifierState
|
|
465
|
-
.HUMIDIFIER_OR_DEHUMIDIFIER &&
|
|
441
|
+
if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
|
|
466
442
|
this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
467
|
-
this.debugLog(
|
|
443
|
+
this.debugLog('Pushing Auto!');
|
|
468
444
|
const payload = {
|
|
469
|
-
commandType:
|
|
470
|
-
command:
|
|
471
|
-
parameter:
|
|
445
|
+
commandType: 'command',
|
|
446
|
+
command: 'setMode',
|
|
447
|
+
parameter: 'auto',
|
|
472
448
|
};
|
|
473
449
|
this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
474
450
|
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
475
451
|
// Make the API request
|
|
476
|
-
const push = await this.platform.axios.post(`${
|
|
452
|
+
const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
477
453
|
this.debugLog(`Humidifier: ${this.accessory.displayName} pushAutoChanges: ${JSON.stringify(push.data)}`);
|
|
478
454
|
this.statusCode(push);
|
|
479
455
|
}
|
|
480
456
|
}
|
|
481
457
|
catch (e) {
|
|
482
458
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection`);
|
|
483
|
-
if (this.deviceLogging
|
|
459
|
+
if (this.deviceLogging === 'debug') {
|
|
484
460
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,` +
|
|
485
461
|
` Error Message: ${JSON.stringify(e.message)}`);
|
|
486
462
|
}
|
|
463
|
+
if (this.platform.debugMode) {
|
|
464
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
465
|
+
}
|
|
487
466
|
this.apiError(e);
|
|
488
467
|
}
|
|
489
468
|
}
|
|
@@ -493,26 +472,29 @@ class Humidifier {
|
|
|
493
472
|
async pushActiveChanges() {
|
|
494
473
|
try {
|
|
495
474
|
if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
|
|
496
|
-
this.debugLog(
|
|
475
|
+
this.debugLog('Pushing Off!');
|
|
497
476
|
const payload = {
|
|
498
|
-
commandType:
|
|
499
|
-
command:
|
|
500
|
-
parameter:
|
|
477
|
+
commandType: 'command',
|
|
478
|
+
command: 'turnOff',
|
|
479
|
+
parameter: 'default',
|
|
501
480
|
};
|
|
502
481
|
this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
|
|
503
482
|
` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
504
483
|
// Make the API request
|
|
505
|
-
const push = await this.platform.axios.post(`${
|
|
484
|
+
const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
506
485
|
this.debugLog(`Humidifier: ${this.accessory.displayName} pushActiveChanges: ${JSON.stringify(push.data)}`);
|
|
507
486
|
this.statusCode(push);
|
|
508
487
|
}
|
|
509
488
|
}
|
|
510
489
|
catch (e) {
|
|
511
490
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection`);
|
|
512
|
-
if (this.deviceLogging
|
|
491
|
+
if (this.deviceLogging === 'debug') {
|
|
513
492
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,` +
|
|
514
493
|
` Error Message: ${JSON.stringify(e.message)}`);
|
|
515
494
|
}
|
|
495
|
+
if (this.platform.debugMode) {
|
|
496
|
+
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
|
|
497
|
+
}
|
|
516
498
|
this.apiError(e);
|
|
517
499
|
}
|
|
518
500
|
}
|
|
@@ -525,8 +507,7 @@ class Humidifier {
|
|
|
525
507
|
}
|
|
526
508
|
else {
|
|
527
509
|
this.service.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
528
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName}` +
|
|
529
|
-
` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
510
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
530
511
|
}
|
|
531
512
|
if (!this.device.ble) {
|
|
532
513
|
if (this.WaterLevel === undefined) {
|
|
@@ -561,8 +542,7 @@ class Humidifier {
|
|
|
561
542
|
this.debugLog(`Humidifier: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
562
543
|
}
|
|
563
544
|
if (this.RelativeHumidityHumidifierThreshold === undefined) {
|
|
564
|
-
this.debugLog(`Humidifier: ${this.accessory.displayName}` +
|
|
565
|
-
` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
|
|
545
|
+
this.debugLog(`Humidifier: ${this.accessory.displayName}` + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
|
|
566
546
|
}
|
|
567
547
|
else {
|
|
568
548
|
this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, this.RelativeHumidityHumidifierThreshold);
|
|
@@ -626,9 +606,7 @@ class Humidifier {
|
|
|
626
606
|
offlineOff() {
|
|
627
607
|
if (this.device.offline) {
|
|
628
608
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
629
|
-
this.service
|
|
630
|
-
.getCharacteristic(this.platform.Characteristic.Active)
|
|
631
|
-
.updateValue(this.Active);
|
|
609
|
+
this.service.getCharacteristic(this.platform.Characteristic.Active).updateValue(this.Active);
|
|
632
610
|
}
|
|
633
611
|
}
|
|
634
612
|
/**
|
|
@@ -655,8 +633,7 @@ class Humidifier {
|
|
|
655
633
|
this.RelativeHumidityHumidifierThreshold = value;
|
|
656
634
|
if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
|
|
657
635
|
this.Active = this.platform.Characteristic.Active.ACTIVE;
|
|
658
|
-
this.CurrentHumidifierDehumidifierState =
|
|
659
|
-
this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
|
|
636
|
+
this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
|
|
660
637
|
}
|
|
661
638
|
this.doHumidifierUpdate.next();
|
|
662
639
|
}
|
|
@@ -666,16 +643,16 @@ class Humidifier {
|
|
|
666
643
|
config = device.humidifier;
|
|
667
644
|
}
|
|
668
645
|
if (device.ble !== undefined) {
|
|
669
|
-
config[
|
|
646
|
+
config['ble'] = device.ble;
|
|
670
647
|
}
|
|
671
648
|
if (device.logging !== undefined) {
|
|
672
|
-
config[
|
|
649
|
+
config['logging'] = device.logging;
|
|
673
650
|
}
|
|
674
651
|
if (device.refreshRate !== undefined) {
|
|
675
|
-
config[
|
|
652
|
+
config['refreshRate'] = device.refreshRate;
|
|
676
653
|
}
|
|
677
654
|
if (device.scanDuration !== undefined) {
|
|
678
|
-
config[
|
|
655
|
+
config['scanDuration'] = device.scanDuration;
|
|
679
656
|
}
|
|
680
657
|
if (Object.entries(config).length !== 0) {
|
|
681
658
|
this.warnLog(`Humidifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
@@ -683,20 +660,17 @@ class Humidifier {
|
|
|
683
660
|
}
|
|
684
661
|
refreshRate(device) {
|
|
685
662
|
if (device.refreshRate) {
|
|
686
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate =
|
|
687
|
-
device.refreshRate;
|
|
663
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
688
664
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
689
665
|
}
|
|
690
666
|
else if (this.platform.config.options.refreshRate) {
|
|
691
|
-
this.deviceRefreshRate = this.accessory.context.refreshRate =
|
|
692
|
-
this.platform.config.options.refreshRate;
|
|
667
|
+
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options.refreshRate;
|
|
693
668
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
694
669
|
}
|
|
695
670
|
}
|
|
696
671
|
scan(device) {
|
|
697
672
|
if (device.scanDuration) {
|
|
698
|
-
this.scanDuration = this.accessory.context.scanDuration =
|
|
699
|
-
device.scanDuration;
|
|
673
|
+
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
700
674
|
if (device.ble) {
|
|
701
675
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
|
|
702
676
|
}
|
|
@@ -710,7 +684,7 @@ class Humidifier {
|
|
|
710
684
|
}
|
|
711
685
|
logs(device) {
|
|
712
686
|
if (this.platform.debugMode) {
|
|
713
|
-
this.deviceLogging = this.accessory.context.logging =
|
|
687
|
+
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
714
688
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
715
689
|
}
|
|
716
690
|
else if (device.logging) {
|
|
@@ -718,12 +692,11 @@ class Humidifier {
|
|
|
718
692
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
|
|
719
693
|
}
|
|
720
694
|
else if (this.platform.config.options?.logging) {
|
|
721
|
-
this.deviceLogging = this.accessory.context.logging =
|
|
722
|
-
this.platform.config.options?.logging;
|
|
695
|
+
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
723
696
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
|
|
724
697
|
}
|
|
725
698
|
else {
|
|
726
|
-
this.deviceLogging = this.accessory.context.logging =
|
|
699
|
+
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
727
700
|
this.debugLog(`Humidifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
728
701
|
}
|
|
729
702
|
}
|
|
@@ -756,8 +729,8 @@ class Humidifier {
|
|
|
756
729
|
}
|
|
757
730
|
debugLog(...log) {
|
|
758
731
|
if (this.enablingDeviceLogging()) {
|
|
759
|
-
if (this.deviceLogging ===
|
|
760
|
-
this.platform.log.info(
|
|
732
|
+
if (this.deviceLogging === 'debug') {
|
|
733
|
+
this.platform.log.info('[DEBUG]', String(...log));
|
|
761
734
|
}
|
|
762
735
|
else {
|
|
763
736
|
this.platform.log.debug(String(...log));
|
|
@@ -765,7 +738,7 @@ class Humidifier {
|
|
|
765
738
|
}
|
|
766
739
|
}
|
|
767
740
|
enablingDeviceLogging() {
|
|
768
|
-
return
|
|
741
|
+
return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
|
|
769
742
|
}
|
|
770
743
|
}
|
|
771
744
|
exports.Humidifier = Humidifier;
|