homebridge-tasmota-control 1.1.9 → 1.2.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 +10 -0
- package/README.md +5 -2
- package/config.schema.json +29 -10
- package/index.js +21 -16
- package/package.json +1 -1
- package/src/tasmotadevice.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.0] - (31.01.2025)
|
|
9
|
+
|
|
10
|
+
## Changes
|
|
11
|
+
|
|
12
|
+
- added possibility to disable/enable log success, info, warn, error
|
|
13
|
+
- bump dependencies
|
|
14
|
+
- config schema updated
|
|
15
|
+
- redme updated
|
|
16
|
+
- cleanup
|
|
17
|
+
|
|
8
18
|
## [1.1.8] - (05.01.2025)
|
|
9
19
|
|
|
10
20
|
## Changes
|
package/README.md
CHANGED
|
@@ -141,6 +141,9 @@ Homebridge plugin for Tasmota flashed devices.
|
|
|
141
141
|
| `sensorsNamePrefix` | Here enable/disable the accessory name as a prefix for sensors name. |
|
|
142
142
|
| `loadNameFromDevice` | If enabled, the accessory name will be loaded direct from device. |
|
|
143
143
|
| `refreshInterval` | Here set the data refresh time in (sec). |
|
|
144
|
-
| `enableDebugMode` | This enable debug log in homebridge console. |
|
|
145
|
-
| `disableLogInfo` | This disable log info, all values and state will not be displayed in Homebridge log console. |
|
|
146
144
|
| `disableLogDeviceInfo` | If enabled, add ability to disable log device info by every connections device to the network. |
|
|
145
|
+
| `disableLogInfo` | If enabled, disable log info, all values and state will not be displayed in Homebridge log console. |
|
|
146
|
+
| `disableLogSuccess` | If enabled, disable logging device success. |
|
|
147
|
+
| `disableLogWarn` | If enabled, disable logging device warnings. |
|
|
148
|
+
| `disableLogError` | If enabled, disable logging device error. |
|
|
149
|
+
| `enableDebugMode` | If enabled, deep log will be present in homebridge console. |
|
package/config.schema.json
CHANGED
|
@@ -1257,25 +1257,41 @@
|
|
|
1257
1257
|
"description": "Here set the data refresh time in (sec).",
|
|
1258
1258
|
"required": true
|
|
1259
1259
|
},
|
|
1260
|
-
"
|
|
1261
|
-
"title": "
|
|
1260
|
+
"disableLogDeviceInfo": {
|
|
1261
|
+
"title": "Disable Log Device Info",
|
|
1262
1262
|
"type": "boolean",
|
|
1263
1263
|
"default": false,
|
|
1264
|
-
"description": "This
|
|
1264
|
+
"description": "This disable logging device info by every connections device to the network.",
|
|
1265
1265
|
"required": false
|
|
1266
1266
|
},
|
|
1267
1267
|
"disableLogInfo": {
|
|
1268
1268
|
"title": "Disable Log Info",
|
|
1269
1269
|
"type": "boolean",
|
|
1270
1270
|
"default": false,
|
|
1271
|
-
"description": "This disable logging values and states on every it change.",
|
|
1272
1271
|
"required": false
|
|
1273
1272
|
},
|
|
1274
|
-
"
|
|
1275
|
-
"title": "Disable Log
|
|
1273
|
+
"disableLogSuccess": {
|
|
1274
|
+
"title": "Disable Log Success",
|
|
1275
|
+
"type": "boolean",
|
|
1276
|
+
"default": false,
|
|
1277
|
+
"required": false
|
|
1278
|
+
},
|
|
1279
|
+
"disableLogWarn": {
|
|
1280
|
+
"title": "Disable Log Warn",
|
|
1281
|
+
"type": "boolean",
|
|
1282
|
+
"default": false,
|
|
1283
|
+
"required": false
|
|
1284
|
+
},
|
|
1285
|
+
"disableLogError": {
|
|
1286
|
+
"title": "Disable Log Error",
|
|
1287
|
+
"type": "boolean",
|
|
1288
|
+
"default": false,
|
|
1289
|
+
"required": false
|
|
1290
|
+
},
|
|
1291
|
+
"enableDebugMode": {
|
|
1292
|
+
"title": "Enable Log Debug",
|
|
1276
1293
|
"type": "boolean",
|
|
1277
1294
|
"default": false,
|
|
1278
|
-
"description": "This disable log device info by every connections device to the network.",
|
|
1279
1295
|
"required": false
|
|
1280
1296
|
}
|
|
1281
1297
|
}
|
|
@@ -1452,11 +1468,14 @@
|
|
|
1452
1468
|
},
|
|
1453
1469
|
{
|
|
1454
1470
|
"key": "devices[]",
|
|
1455
|
-
"title": "
|
|
1471
|
+
"title": "Log",
|
|
1456
1472
|
"items": [
|
|
1457
|
-
"devices[].
|
|
1473
|
+
"devices[].disableLogDeviceInfo",
|
|
1458
1474
|
"devices[].disableLogInfo",
|
|
1459
|
-
"devices[].
|
|
1475
|
+
"devices[].disableLogSuccess",
|
|
1476
|
+
"devices[].disableLogWarn",
|
|
1477
|
+
"devices[].disableLogError",
|
|
1478
|
+
"devices[].enableDebugMode"
|
|
1460
1479
|
]
|
|
1461
1480
|
}
|
|
1462
1481
|
]
|
package/index.js
CHANGED
|
@@ -32,15 +32,20 @@ class tasmotaPlatform {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
//log config
|
|
36
36
|
const enableDebugMode = device.enableDebugMode || false;
|
|
37
|
-
const
|
|
37
|
+
const disableLogDeviceInfo = device.disableLogDeviceInfo || false;
|
|
38
|
+
const disableLogInfo = device.disableLogInfo || false;
|
|
39
|
+
const disableLogSuccess = device.disableLogSuccess || false;
|
|
40
|
+
const disableLogWarn = device.disableLogWarn || false;
|
|
41
|
+
const disableLogError = device.disableLogError || false;
|
|
42
|
+
const debug = enableDebugMode ? log.info(`Device: ${host} ${deviceName}, debug: Did finish launching.`) : false;
|
|
38
43
|
const config = {
|
|
39
44
|
...device,
|
|
40
45
|
user: 'removed',
|
|
41
46
|
passwd: 'removed'
|
|
42
47
|
};
|
|
43
|
-
const debug1 = enableDebugMode ? log.info(`Device: ${host} ${deviceName}, Config: ${JSON.stringify(config, null, 2)}.`)
|
|
48
|
+
const debug1 = !enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, Config: ${JSON.stringify(config, null, 2)}.`);
|
|
44
49
|
|
|
45
50
|
//check files exists, if not then create it
|
|
46
51
|
const postFix = device.host.split('.').join('');
|
|
@@ -70,25 +75,25 @@ class tasmotaPlatform {
|
|
|
70
75
|
const tasmotaDevice = new TasmotaDevice(api, device, miElHvac, defaultHeatingSetTemperatureFile, defaultCoolingSetTemperatureFile);
|
|
71
76
|
tasmotaDevice.on('publishAccessory', (accessory) => {
|
|
72
77
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
73
|
-
log.success(`Device: ${host} ${deviceName}, Published as external accessory.`);
|
|
78
|
+
const emitLog = disableLogSuccess ? false : log.success(`Device: ${host} ${deviceName}, Published as external accessory.`);
|
|
74
79
|
})
|
|
75
80
|
.on('devInfo', (devInfo) => {
|
|
76
|
-
log.info(devInfo);
|
|
81
|
+
const emitLog = disableLogDeviceInfo ? false : log.info(devInfo);
|
|
77
82
|
})
|
|
78
|
-
.on('success', (
|
|
79
|
-
log.success(`Device: ${host} ${deviceName}, ${
|
|
83
|
+
.on('success', (success) => {
|
|
84
|
+
const emitLog = disableLogSuccess ? false : log.success(`Device: ${host} ${deviceName}, ${success}.`);
|
|
80
85
|
})
|
|
81
|
-
.on('
|
|
82
|
-
log.info(`Device: ${host} ${deviceName}, ${
|
|
86
|
+
.on('info', (info) => {
|
|
87
|
+
const emitLog = disableLogInfo ? false : log.info(`Device: ${host} ${deviceName}, ${info}.`);
|
|
83
88
|
})
|
|
84
89
|
.on('debug', (debug) => {
|
|
85
|
-
log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
90
|
+
const emitLog = !enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
86
91
|
})
|
|
87
92
|
.on('warn', (warn) => {
|
|
88
|
-
log.warn(`Device: ${host} ${deviceName}
|
|
93
|
+
const emitLog = disableLogWarn ? false : log.warn(`Device: ${host} ${deviceName}, ${warn}.`);
|
|
89
94
|
})
|
|
90
|
-
.on('error',
|
|
91
|
-
log.error(`Device: ${host} ${deviceName}, ${error}.`);
|
|
95
|
+
.on('error', (error) => {
|
|
96
|
+
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}.`);
|
|
92
97
|
});
|
|
93
98
|
|
|
94
99
|
//create impulse generator
|
|
@@ -98,16 +103,16 @@ class tasmotaPlatform {
|
|
|
98
103
|
const startDone = await tasmotaDevice.start();
|
|
99
104
|
const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
|
|
100
105
|
} catch (error) {
|
|
101
|
-
log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
|
|
106
|
+
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
|
|
102
107
|
};
|
|
103
108
|
}).on('state', (state) => {
|
|
104
|
-
const
|
|
109
|
+
const emitLog = !enableDebugMode ? false : state ? log.info(`Device: ${host} ${deviceName}, Start impulse generator started.`) : log.info(`Device: ${host} ${deviceName}, Start impulse generator stopped.`);
|
|
105
110
|
});
|
|
106
111
|
|
|
107
112
|
//start impulse generator
|
|
108
113
|
await impulseGenerator.start([{ name: 'start', sampling: 45000 }]);
|
|
109
114
|
} catch (error) {
|
|
110
|
-
|
|
115
|
+
throw new Error(`Device: ${host} ${deviceName}, Did finish launching error: ${error}.`);
|
|
111
116
|
}
|
|
112
117
|
};
|
|
113
118
|
});
|
package/package.json
CHANGED
package/src/tasmotadevice.js
CHANGED
|
@@ -1286,8 +1286,8 @@ class TasmotaDevice extends EventEmitter {
|
|
|
1286
1286
|
};
|
|
1287
1287
|
}
|
|
1288
1288
|
|
|
1289
|
-
async scaleValue(value,
|
|
1290
|
-
const scaledValue = parseFloat((((Math.max(
|
|
1289
|
+
async scaleValue(value, inMin, inMax, outMin, outMax) {
|
|
1290
|
+
const scaledValue = parseFloat((((Math.max(inMin, Math.min(inMax, value)) - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin).toFixed(0));
|
|
1291
1291
|
return scaledValue;
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
@@ -2465,6 +2465,7 @@ class TasmotaDevice extends EventEmitter {
|
|
|
2465
2465
|
const timers = [{ name: 'checkDeviceState', sampling: this.refreshInterval }];
|
|
2466
2466
|
const remoteTempSensor = this.remoteTemperatureSensorEnable ? timers.push({ name: 'updateRemoteTemp', sampling: this.remoteTemperatureSensorRefreshInterval }) : false;
|
|
2467
2467
|
await this.impulseGenerator.start(timers);
|
|
2468
|
+
|
|
2468
2469
|
return true;
|
|
2469
2470
|
} catch (error) {
|
|
2470
2471
|
throw new Error(`Start error: ${error}`);
|