homebridge-tasmota-control 0.4.32 → 0.4.33
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/index.js +9 -14
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -36,33 +36,28 @@ class tasmotaPlatform {
|
|
|
36
36
|
log(`No configuration found for ${PLUGIN_NAME}.`);
|
|
37
37
|
return;
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
this.log = log;
|
|
41
|
-
this.api = api;
|
|
42
39
|
this.accessories = [];
|
|
43
|
-
const devices = config.devices;
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (const device of devices) {
|
|
41
|
+
api.on('didFinishLaunching', () => {
|
|
42
|
+
for (const device of config.devices) {
|
|
48
43
|
if (!device.name || !device.host) {
|
|
49
|
-
|
|
44
|
+
log.warn('Device name or host missing!');
|
|
50
45
|
return;
|
|
51
46
|
}
|
|
47
|
+
|
|
48
|
+
//debug config
|
|
49
|
+
const debug = device.enableDebugMode ? log(`Device: ${device.host} ${device.name}, did finish launching.`) : false;
|
|
50
|
+
const debug1 = device.enableDebugMode ? log(`Device: ${device.host} ${device.name}, Config: ${JSON.stringify(device, null, 2)}`) : false;
|
|
51
|
+
|
|
52
|
+
//tasmota device
|
|
52
53
|
new tasmotaDevice(this.log, device, this.api);
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
configureAccessory(accessory) {
|
|
58
|
-
this.log.debug('configureAccessory');
|
|
59
59
|
this.accessories.push(accessory);
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
removeAccessory(accessory) {
|
|
63
|
-
this.log.debug('removeAccessory');
|
|
64
|
-
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
65
|
-
};
|
|
66
61
|
};
|
|
67
62
|
|
|
68
63
|
class tasmotaDevice {
|
package/package.json
CHANGED