@switchbot/homebridge-switchbot 1.8.1-beta.3 → 1.8.2-beta.2
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 +1 -1
- package/dist/devices/bots.js +1 -1
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.js +1 -1
- 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/curtains.js +1 -1
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.js +1 -1
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.js +1 -1
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.js +1 -1
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.js +1 -1
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.js +1 -1
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.js +1 -1
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.js +1 -1
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.js +1 -1
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.js +1 -1
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.js +1 -1
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.js +1 -1
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +1 -1
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.js +1 -1
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +44 -28
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/devices/bots.ts +1 -1
- package/src/devices/colorbulb.ts +1 -1
- package/src/devices/contact.ts +1 -1
- package/src/devices/curtains.ts +1 -1
- package/src/devices/humidifiers.ts +1 -1
- package/src/devices/meters.ts +1 -1
- package/src/devices/motion.ts +1 -1
- package/src/devices/plugs.ts +1 -1
- package/src/irdevices/airconditioners.ts +1 -1
- package/src/irdevices/airpurifiers.ts +1 -1
- package/src/irdevices/cameras.ts +1 -1
- package/src/irdevices/fans.ts +1 -1
- package/src/irdevices/lights.ts +1 -1
- package/src/irdevices/others.ts +1 -1
- package/src/irdevices/tvs.ts +1 -1
- package/src/irdevices/vacuumcleaners.ts +1 -1
- package/src/irdevices/waterheaters.ts +1 -1
- package/src/platform.ts +45 -29
- package/src/settings.ts +1 -1
|
@@ -191,7 +191,7 @@ export class WaterHeater {
|
|
|
191
191
|
if (device.logging !== undefined) {
|
|
192
192
|
config['logging'] = device.logging;
|
|
193
193
|
}
|
|
194
|
-
if (config !==
|
|
194
|
+
if (Object.entries(config).length !== 0) {
|
|
195
195
|
this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
196
196
|
}
|
|
197
197
|
}
|
package/src/platform.ts
CHANGED
|
@@ -97,17 +97,19 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
97
97
|
this.debugMode = process.argv.includes('-D') || process.argv.includes('--debug');
|
|
98
98
|
if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
|
|
99
99
|
this.platformLogging = this.config.options!.logging;
|
|
100
|
-
if (this.
|
|
100
|
+
if (this.platformLogging.includes('debug')) {
|
|
101
101
|
this.log.warn(`Using Config Logging: ${this.platformLogging}`);
|
|
102
102
|
}
|
|
103
103
|
} else if (this.debugMode) {
|
|
104
|
-
if (this.debugMode) {
|
|
105
|
-
this.log.warn('Using debugMode Logging');
|
|
106
|
-
}
|
|
107
104
|
this.platformLogging = 'debugMode';
|
|
105
|
+
if (this.platformLogging?.includes('debug')) {
|
|
106
|
+
this.log.warn(`Using ${this.platformLogging} Logging`);
|
|
107
|
+
}
|
|
108
108
|
} else {
|
|
109
|
-
this.log.warn('Using Standard Logging');
|
|
110
109
|
this.platformLogging = 'standard';
|
|
110
|
+
if (this.platformLogging?.includes('debug')) {
|
|
111
|
+
this.log.warn(`Using ${this.platformLogging} Logging`);
|
|
112
|
+
}
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
@@ -126,14 +128,23 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
126
128
|
* Verify the config passed to the plugin is valid
|
|
127
129
|
*/
|
|
128
130
|
verifyConfig() {
|
|
129
|
-
/**
|
|
130
|
-
* Hidden Device Discovery Option
|
|
131
|
-
* This will disable adding any device and will just output info.
|
|
132
|
-
*/
|
|
133
131
|
this.config.options = this.config.options || {};
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
const platformConfig = {};
|
|
134
|
+
if (this.config.options?.logging) {
|
|
135
|
+
platformConfig['logging'] = this.config.options?.logging;
|
|
136
|
+
}
|
|
137
|
+
if (this.config.options?.logging) {
|
|
138
|
+
platformConfig['refreshRate'] = this.config.options?.refreshRate;
|
|
139
|
+
}
|
|
140
|
+
if (this.config.options?.logging) {
|
|
141
|
+
platformConfig['pushRate'] = this.config.options?.pushRate;
|
|
142
|
+
}
|
|
143
|
+
if (Object.entries(platformConfig).length !== 0) {
|
|
144
|
+
this.warnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
|
|
145
|
+
}
|
|
136
146
|
|
|
147
|
+
if (this.config.options) {
|
|
137
148
|
// Device Config
|
|
138
149
|
if (this.config.options.devices) {
|
|
139
150
|
for (const deviceConfig of this.config.options.devices) {
|
|
@@ -170,41 +181,32 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
170
181
|
if (!this.config.options.refreshRate) {
|
|
171
182
|
// default 120 seconds (2 minutes)
|
|
172
183
|
this.config.options!.refreshRate! = 120;
|
|
173
|
-
if (this.
|
|
174
|
-
this.
|
|
184
|
+
if (this.platformLogging?.includes('debug')) {
|
|
185
|
+
this.debugLog('Using Default Refresh Rate (2 minutes).');
|
|
175
186
|
}
|
|
176
187
|
|
|
177
188
|
if (!this.config.options.pushRate) {
|
|
178
189
|
// default 100 milliseconds
|
|
179
190
|
this.config.options!.pushRate! = 0.1;
|
|
180
|
-
if (this.
|
|
191
|
+
if (this.platformLogging?.includes('debug')) {
|
|
181
192
|
this.warnLog('Using Default Push Rate.');
|
|
182
193
|
}
|
|
183
194
|
}
|
|
184
195
|
|
|
185
196
|
if (!this.config.credentials) {
|
|
186
|
-
this.
|
|
197
|
+
if (this.platformLogging?.includes('debug')) {
|
|
198
|
+
this.debugLog('Missing Credentials');
|
|
199
|
+
}
|
|
187
200
|
}
|
|
188
201
|
if (!this.config.credentials?.openToken) {
|
|
189
|
-
this.
|
|
190
|
-
|
|
202
|
+
if (this.platformLogging?.includes('debug')) {
|
|
203
|
+
this.errorLog('Missing openToken');
|
|
204
|
+
this.warnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
|
|
205
|
+
}
|
|
191
206
|
}
|
|
192
207
|
}
|
|
193
208
|
}
|
|
194
209
|
|
|
195
|
-
connectBLE() {
|
|
196
|
-
let Switchbot: new () => any;
|
|
197
|
-
let switchbot: any;
|
|
198
|
-
try {
|
|
199
|
-
Switchbot = require('node-switchbot');
|
|
200
|
-
switchbot = new Switchbot();
|
|
201
|
-
} catch (e) {
|
|
202
|
-
switchbot = false;
|
|
203
|
-
this.errorLog(`Was 'node-switchbot' found: ${switchbot}`);
|
|
204
|
-
}
|
|
205
|
-
return switchbot;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
210
|
/**
|
|
209
211
|
* this method discovers devices
|
|
210
212
|
*/
|
|
@@ -1499,6 +1501,20 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1499
1501
|
}
|
|
1500
1502
|
}
|
|
1501
1503
|
|
|
1504
|
+
// BLE Connection
|
|
1505
|
+
connectBLE() {
|
|
1506
|
+
let Switchbot: new () => any;
|
|
1507
|
+
let switchbot: any;
|
|
1508
|
+
try {
|
|
1509
|
+
Switchbot = require('node-switchbot');
|
|
1510
|
+
switchbot = new Switchbot();
|
|
1511
|
+
} catch (e) {
|
|
1512
|
+
switchbot = false;
|
|
1513
|
+
this.errorLog(`Was 'node-switchbot' found: ${switchbot}`);
|
|
1514
|
+
}
|
|
1515
|
+
return switchbot;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1502
1518
|
/**
|
|
1503
1519
|
* If device level logging is turned on, log to log.warn
|
|
1504
1520
|
* Otherwise send debug logs to log.debug
|
package/src/settings.ts
CHANGED