homebridge-tasmota-control 1.8.0-beta.0 → 1.8.0-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 +13 -0
- package/README.md +11 -6
- package/config.schema.json +48 -60
- package/index.js +13 -13
- package/package.json +2 -2
- package/src/fans.js +37 -37
- package/src/lights.js +17 -17
- package/src/mielhvac.js +28 -28
- package/src/sensors.js +42 -42
- package/src/switches.js +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ 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
|
+
## Warning
|
|
9
|
+
|
|
10
|
+
- For plugin < v1.8.0 use Homebridge UI <= v5.5.0
|
|
11
|
+
- For plugin >= v1.8.0 use Homebridge UI >= v5.13.0
|
|
12
|
+
|
|
13
|
+
## [1.8.0] - (03.01.2026)
|
|
14
|
+
|
|
15
|
+
## Changes
|
|
16
|
+
|
|
17
|
+
- added support for Homebridge UI >= v5.13.0
|
|
18
|
+
- config schema updated
|
|
19
|
+
- readme updated
|
|
20
|
+
|
|
8
21
|
## [1.6.15] - (13.09.2025)
|
|
9
22
|
|
|
10
23
|
## Changes
|
package/README.md
CHANGED
|
@@ -25,6 +25,11 @@ Homebridge plugin for Tasmota flashed devices.
|
|
|
25
25
|
| [Config UI X](https://github.com/homebridge/homebridge-config-ui-x) | [Config UI X Wiki](https://github.com/homebridge/homebridge-config-ui-x/wiki) | Homebridge Web User Interface | Recommended |
|
|
26
26
|
| [Tasmota Control](https://www.npmjs.com/package/homebridge-tasmota-control) | [Plug-In Wiki](https://github.com/grzegorz914/homebridge-tasmota-control/wiki) | Homebridge Plug-In | Required |
|
|
27
27
|
|
|
28
|
+
## Warning
|
|
29
|
+
|
|
30
|
+
* For plugin < v1.8.0 use Homebridge UI <= v5.5.0.
|
|
31
|
+
* For plugin >= v1.8.0 use Homebridge UI >= v5.13.0.
|
|
32
|
+
|
|
28
33
|
## About The Plugin
|
|
29
34
|
|
|
30
35
|
* Plugin work with Tasmota v6.0.0 and abowe.
|
|
@@ -150,9 +155,9 @@ Homebridge plugin for Tasmota flashed devices.
|
|
|
150
155
|
| `sensorsNamePrefix` | Here enable/disable the accessory name as a prefix for sensors name. |
|
|
151
156
|
| `loadNameFromDevice` | If enabled, the accessory name will be loaded direct from device. |
|
|
152
157
|
| `refreshInterval` | Here set the data refresh time in (sec). |
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
158
|
+
| `log.deviceInfo` | If enabled, log device info will be displayed by every connections device to the network. |
|
|
159
|
+
| `log.success` | If enabled, success log will be displayed in console. |
|
|
160
|
+
| `log.info` | If enabled, info log will be displayed in console. |
|
|
161
|
+
| `log.warn` | If enabled, warn log will be displayed in console. |
|
|
162
|
+
| `log.error` | If enabled, error log will be displayed in console. |
|
|
163
|
+
| `log.debug` | If enabled, debug log will be displayed in console. |
|
package/config.schema.json
CHANGED
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"maximum": 5,
|
|
249
249
|
"anyOf": [
|
|
250
250
|
{
|
|
251
|
-
"title": "
|
|
251
|
+
"title": "Disabled",
|
|
252
252
|
"enum": [
|
|
253
253
|
0
|
|
254
254
|
]
|
|
@@ -1413,36 +1413,42 @@
|
|
|
1413
1413
|
"default": 5,
|
|
1414
1414
|
"description": "Here set the data refresh time in (sec)."
|
|
1415
1415
|
},
|
|
1416
|
-
"
|
|
1417
|
-
"title": "
|
|
1418
|
-
"type": "
|
|
1419
|
-
"
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1416
|
+
"log": {
|
|
1417
|
+
"title": "Log",
|
|
1418
|
+
"type": "object",
|
|
1419
|
+
"properties": {
|
|
1420
|
+
"deviceInfo": {
|
|
1421
|
+
"title": "Device Info",
|
|
1422
|
+
"type": "boolean",
|
|
1423
|
+
"default": true,
|
|
1424
|
+
"description": "This enable logging device info by every connections device to the network."
|
|
1425
|
+
},
|
|
1426
|
+
"success": {
|
|
1427
|
+
"title": "Success",
|
|
1428
|
+
"type": "boolean",
|
|
1429
|
+
"default": true
|
|
1430
|
+
},
|
|
1431
|
+
"info": {
|
|
1432
|
+
"title": "Info",
|
|
1433
|
+
"type": "boolean",
|
|
1434
|
+
"default": false
|
|
1435
|
+
},
|
|
1436
|
+
"warn": {
|
|
1437
|
+
"title": "Warn",
|
|
1438
|
+
"type": "boolean",
|
|
1439
|
+
"default": true
|
|
1440
|
+
},
|
|
1441
|
+
"error": {
|
|
1442
|
+
"title": "Error",
|
|
1443
|
+
"type": "boolean",
|
|
1444
|
+
"default": true
|
|
1445
|
+
},
|
|
1446
|
+
"debug": {
|
|
1447
|
+
"title": "Debug",
|
|
1448
|
+
"type": "boolean",
|
|
1449
|
+
"default": false
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1446
1452
|
}
|
|
1447
1453
|
},
|
|
1448
1454
|
"required": [
|
|
@@ -1450,24 +1456,6 @@
|
|
|
1450
1456
|
"host"
|
|
1451
1457
|
],
|
|
1452
1458
|
"allOf": [
|
|
1453
|
-
{
|
|
1454
|
-
"if": {
|
|
1455
|
-
"required": [
|
|
1456
|
-
"auth"
|
|
1457
|
-
],
|
|
1458
|
-
"properties": {
|
|
1459
|
-
"auth": {
|
|
1460
|
-
"const": true
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
},
|
|
1464
|
-
"then": {
|
|
1465
|
-
"required": [
|
|
1466
|
-
"path",
|
|
1467
|
-
"refreshInterval"
|
|
1468
|
-
]
|
|
1469
|
-
}
|
|
1470
|
-
},
|
|
1471
1459
|
{
|
|
1472
1460
|
"if": {
|
|
1473
1461
|
"required": [
|
|
@@ -1495,7 +1483,7 @@
|
|
|
1495
1483
|
{
|
|
1496
1484
|
"key": "devices",
|
|
1497
1485
|
"type": "tabarray",
|
|
1498
|
-
"title": "{{ value.name || '
|
|
1486
|
+
"title": "{{ value.name || 'Device' }}",
|
|
1499
1487
|
"items": [
|
|
1500
1488
|
"devices[].name",
|
|
1501
1489
|
"devices[].host",
|
|
@@ -1547,7 +1535,7 @@
|
|
|
1547
1535
|
{
|
|
1548
1536
|
"key": "devices[].miElHvac.presets",
|
|
1549
1537
|
"type": "tabarray",
|
|
1550
|
-
"title": "{{ value.name || '
|
|
1538
|
+
"title": "{{ value.name || 'Preset'}}",
|
|
1551
1539
|
"items": [
|
|
1552
1540
|
"devices[].miElHvac.presets[].displayType",
|
|
1553
1541
|
"devices[].miElHvac.presets[].name",
|
|
@@ -1571,7 +1559,7 @@
|
|
|
1571
1559
|
{
|
|
1572
1560
|
"key": "devices[].miElHvac.buttons",
|
|
1573
1561
|
"type": "tabarray",
|
|
1574
|
-
"title": "{{ value.name || '
|
|
1562
|
+
"title": "{{ value.name || 'Button' }}",
|
|
1575
1563
|
"items": [
|
|
1576
1564
|
"devices[].miElHvac.buttons[].displayType",
|
|
1577
1565
|
"devices[].miElHvac.buttons[].name",
|
|
@@ -1593,7 +1581,7 @@
|
|
|
1593
1581
|
{
|
|
1594
1582
|
"key": "devices[].miElHvac.sensors",
|
|
1595
1583
|
"type": "tabarray",
|
|
1596
|
-
"title": "{{ value.name || '
|
|
1584
|
+
"title": "{{ value.name || 'Sensor' }}",
|
|
1597
1585
|
"items": [
|
|
1598
1586
|
"devices[].miElHvac.sensors[].displayType",
|
|
1599
1587
|
"devices[].miElHvac.sensors[].name",
|
|
@@ -1667,15 +1655,15 @@
|
|
|
1667
1655
|
]
|
|
1668
1656
|
},
|
|
1669
1657
|
{
|
|
1670
|
-
"key": "devices[]",
|
|
1658
|
+
"key": "devices[].log",
|
|
1671
1659
|
"title": "Log",
|
|
1672
1660
|
"items": [
|
|
1673
|
-
"devices[].
|
|
1674
|
-
"devices[].
|
|
1675
|
-
"devices[].
|
|
1676
|
-
"devices[].
|
|
1677
|
-
"devices[].
|
|
1678
|
-
"devices[].
|
|
1661
|
+
"devices[].log.deviceInfo",
|
|
1662
|
+
"devices[].log.success",
|
|
1663
|
+
"devices[].log.info",
|
|
1664
|
+
"devices[].log.warn",
|
|
1665
|
+
"devices[].log.error",
|
|
1666
|
+
"devices[].log.debug"
|
|
1679
1667
|
]
|
|
1680
1668
|
}
|
|
1681
1669
|
]
|
package/index.js
CHANGED
|
@@ -52,14 +52,14 @@ class tasmotaPlatform {
|
|
|
52
52
|
const remoteTemperatureSensorRefreshInterval = (device.miElHvac?.remoteTemperatureSensor?.refreshInterval ?? 5) * 1000;
|
|
53
53
|
const refreshInterval = (device.refreshInterval ?? 5) * 1000;
|
|
54
54
|
|
|
55
|
-
//log
|
|
55
|
+
//log config
|
|
56
56
|
const logLevel = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
warn:
|
|
61
|
-
error:
|
|
62
|
-
|
|
57
|
+
devInfo: device.log?.deviceInfo,
|
|
58
|
+
success: device.log?.success,
|
|
59
|
+
info: device.log?.info,
|
|
60
|
+
warn: device.log?.warn,
|
|
61
|
+
error: device.log?.error,
|
|
62
|
+
debug: device.log?.debug
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
if (logLevel.debug) log.info(`Device: ${host} ${deviceName}, debug: Did finish launching.`);
|
|
@@ -136,12 +136,12 @@ class tasmotaPlatform {
|
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
deviceType.on('devInfo', (msg) =>
|
|
140
|
-
.on('success', (msg) =>
|
|
141
|
-
.on('info', (msg) =>
|
|
142
|
-
.on('debug', (msg) =>
|
|
143
|
-
.on('warn', (msg) =>
|
|
144
|
-
.on('error', (msg) =>
|
|
139
|
+
deviceType.on('devInfo', (msg) => log.info(msg))
|
|
140
|
+
.on('success', (msg) => log.success(`Device: ${host} ${deviceName}, ${msg}`))
|
|
141
|
+
.on('info', (msg) => log.info(`Device: ${host} ${deviceName}, ${msg}`))
|
|
142
|
+
.on('debug', (msg) => log.info(`Device: ${host} ${deviceName}, debug: ${msg}`))
|
|
143
|
+
.on('warn', (msg) => log.warn(`Device: ${host} ${deviceName}, ${msg}`))
|
|
144
|
+
.on('error', (msg) => log.error(`Device: ${host} ${deviceName}, ${msg}`));
|
|
145
145
|
|
|
146
146
|
const accessory = await deviceType.start();
|
|
147
147
|
if (accessory) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Tasmota Control",
|
|
3
3
|
"name": "homebridge-tasmota-control",
|
|
4
|
-
"version": "1.8.0-beta.
|
|
4
|
+
"version": "1.8.0-beta.2",
|
|
5
5
|
"description": "Homebridge plugin to control Tasmota flashed devices.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
32
|
"engines": {
|
|
33
|
-
"homebridge": "^1.8.0 || ^2.0.0 || ^2.0.0-beta.40 || ^2.0.0-alpha.
|
|
33
|
+
"homebridge": "^1.8.0 || ^2.0.0 || ^2.0.0-beta.40 || ^2.0.0-alpha.60",
|
|
34
34
|
"node": "^20 || ^22 || ^24 || ^25"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
package/src/fans.js
CHANGED
|
@@ -22,9 +22,9 @@ class Fans extends EventEmitter {
|
|
|
22
22
|
//other config
|
|
23
23
|
this.lightsNamePrefix = config.lightsNamePrefix || false;
|
|
24
24
|
this.fansNamePrefix = config.fansNamePrefix || false;
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
25
|
+
this.logDeviceInfo = device.log?.deviceInfo || false;
|
|
26
|
+
this.logInfo = device.log?.info || false;
|
|
27
|
+
this.logDebug = device.log?.debug || false;
|
|
28
28
|
this.functions = new Functions();
|
|
29
29
|
|
|
30
30
|
//axios instance
|
|
@@ -57,18 +57,18 @@ class Fans extends EventEmitter {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async checkState() {
|
|
60
|
-
if (this.
|
|
60
|
+
if (this.logDebug) this.emit('debug', `Requesting status`);
|
|
61
61
|
try {
|
|
62
62
|
//power status
|
|
63
63
|
const powerStatusData = await this.client.get(ApiCommands.PowerStatus);
|
|
64
64
|
const powerStatus = powerStatusData.data ?? {};
|
|
65
65
|
const powerStatusKeys = Object.keys(powerStatus);
|
|
66
|
-
if (this.
|
|
66
|
+
if (this.logDebug) this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`);
|
|
67
67
|
|
|
68
68
|
//sensor status
|
|
69
69
|
const sensorStatusData = await this.client.get(ApiCommands.Status);
|
|
70
70
|
const sensorStatus = sensorStatusData.data ?? {};
|
|
71
|
-
if (this.
|
|
71
|
+
if (this.logDebug) this.emit('debug', `Sensors status: ${JSON.stringify(sensorStatus, null, 2)}`);
|
|
72
72
|
|
|
73
73
|
//sensor status keys
|
|
74
74
|
const sensorStatusKeys = Object.keys(sensorStatus);
|
|
@@ -130,7 +130,7 @@ class Fans extends EventEmitter {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
//log info
|
|
133
|
-
if (
|
|
133
|
+
if (this.logInfo) {
|
|
134
134
|
this.emit('info', `${friendlyName}, light: ${power ? 'ON' : 'OFF'}`);
|
|
135
135
|
this.emit('info', `${friendlyName}, fan: ${powerFan ? 'ON' : 'OFF'}`);
|
|
136
136
|
//this.emit('info', `${friendlyName}, direction: ${direction}`);
|
|
@@ -158,7 +158,7 @@ class Fans extends EventEmitter {
|
|
|
158
158
|
|
|
159
159
|
//prepare accessory
|
|
160
160
|
async prepareAccessory() {
|
|
161
|
-
if (this.
|
|
161
|
+
if (this.logDebug) this.emit('debug', `Prepare Accessory`);
|
|
162
162
|
|
|
163
163
|
try {
|
|
164
164
|
//accessory
|
|
@@ -168,7 +168,7 @@ class Fans extends EventEmitter {
|
|
|
168
168
|
const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
|
|
169
169
|
|
|
170
170
|
//Prepare information service
|
|
171
|
-
if (this.
|
|
171
|
+
if (this.logDebug) this.emit('debug', `Prepare Information Service`);
|
|
172
172
|
accessory.getService(Service.AccessoryInformation)
|
|
173
173
|
.setCharacteristic(Characteristic.Manufacturer, 'Tasmota')
|
|
174
174
|
.setCharacteristic(Characteristic.Model, this.info.modelName ?? 'Model Name')
|
|
@@ -177,9 +177,9 @@ class Fans extends EventEmitter {
|
|
|
177
177
|
.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
178
178
|
|
|
179
179
|
//Prepare services
|
|
180
|
-
if (this.
|
|
180
|
+
if (this.logDebug) this.emit('debug', `Prepare Services`);
|
|
181
181
|
if (this.fans.length > 0) {
|
|
182
|
-
if (this.
|
|
182
|
+
if (this.logDebug) this.emit('debug', `Prepare Fan Services`);
|
|
183
183
|
this.fanServices = [];
|
|
184
184
|
|
|
185
185
|
for (let i = 0; i < this.fans.length; i++) {
|
|
@@ -199,7 +199,7 @@ class Fans extends EventEmitter {
|
|
|
199
199
|
state = state ? 1 : 0;
|
|
200
200
|
const speed = `${ApiCommands.FanSpeed}${state}`;
|
|
201
201
|
await this.client.get(speed);
|
|
202
|
-
if (
|
|
202
|
+
if (this.logInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
|
|
203
203
|
} catch (error) {
|
|
204
204
|
this.emit('warn', `${friendlyName}, set state error: ${error}`);
|
|
205
205
|
}
|
|
@@ -213,7 +213,7 @@ class Fans extends EventEmitter {
|
|
|
213
213
|
// try {
|
|
214
214
|
// const direction = `${ApiCommands.FanDirection}${value}`;
|
|
215
215
|
// await this.client.get(direction);
|
|
216
|
-
// if (
|
|
216
|
+
// if (this.logInfo) this.emit('info', `${friendlyName}, set direction: ${value}`);
|
|
217
217
|
// } catch (error) {
|
|
218
218
|
// this.emit('warn', `${friendlyName}, set direction error: ${error}`);
|
|
219
219
|
// }
|
|
@@ -232,7 +232,7 @@ class Fans extends EventEmitter {
|
|
|
232
232
|
try {
|
|
233
233
|
const speed = `${ApiCommands.FanSpeed}${value}`;
|
|
234
234
|
await this.client.get(speed);
|
|
235
|
-
if (
|
|
235
|
+
if (this.logInfo) this.emit('info', `${friendlyName}, set speed: ${value}`);
|
|
236
236
|
} catch (error) {
|
|
237
237
|
this.emit('warn', `${friendlyName}, set rotation speed error: ${error}`);
|
|
238
238
|
}
|
|
@@ -262,7 +262,7 @@ class Fans extends EventEmitter {
|
|
|
262
262
|
const powerOff = this.lights.length === 1 ? (this.lights[i].power1 ? `${ApiCommands.Power}${relayNr}${ApiCommands.Off}` : ApiCommands.PowerOff) : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
|
|
263
263
|
state = state ? powerOn : powerOff;
|
|
264
264
|
await this.client.get(state);
|
|
265
|
-
if (
|
|
265
|
+
if (this.logInfo) this.emit('info', `${friendlyName}, set state: ${state ? 'ON' : 'OFF'}`);
|
|
266
266
|
} catch (error) {
|
|
267
267
|
this.emit('warn', `${friendlyName}, set state error: ${error}`);
|
|
268
268
|
}
|
|
@@ -273,12 +273,12 @@ class Fans extends EventEmitter {
|
|
|
273
273
|
|
|
274
274
|
//sensors
|
|
275
275
|
if (this.sensorsCount > 0) {
|
|
276
|
-
if (this.
|
|
276
|
+
if (this.logDebug) this.emit('debug', `Prepare Sensor Services`);
|
|
277
277
|
|
|
278
278
|
//temperature
|
|
279
279
|
const sensorsTemperatureCount = this.sensorsTemperatureCount;
|
|
280
280
|
if (sensorsTemperatureCount > 0) {
|
|
281
|
-
if (this.
|
|
281
|
+
if (this.logDebug) this.emit('debug', `Prepare Temperature Sensor Services`);
|
|
282
282
|
this.sensorTemperatureServices = [];
|
|
283
283
|
for (let i = 0; i < sensorsTemperatureCount; i++) {
|
|
284
284
|
const sensorName = this.sensorsName[i];
|
|
@@ -289,7 +289,7 @@ class Fans extends EventEmitter {
|
|
|
289
289
|
sensorTemperatureService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
290
290
|
.onGet(async () => {
|
|
291
291
|
const value = this.sensorsTemperature[i];
|
|
292
|
-
if (
|
|
292
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} temperature: ${value} °${this.tempUnit}`);
|
|
293
293
|
return value;
|
|
294
294
|
});
|
|
295
295
|
this.sensorTemperatureServices.push(sensorTemperatureService);
|
|
@@ -299,7 +299,7 @@ class Fans extends EventEmitter {
|
|
|
299
299
|
//reference temperature
|
|
300
300
|
const sensorsReferenceTemperatureCount = this.sensorsReferenceTemperatureCount;
|
|
301
301
|
if (sensorsReferenceTemperatureCount > 0) {
|
|
302
|
-
if (this.
|
|
302
|
+
if (this.logDebug) this.emit('debug', `Prepare Reference Temperature Sensor Services`);
|
|
303
303
|
this.sensorReferenceTemperatureServices = [];
|
|
304
304
|
for (let i = 0; i < sensorsReferenceTemperatureCount; i++) {
|
|
305
305
|
const sensorName = this.sensorsName[i];
|
|
@@ -310,7 +310,7 @@ class Fans extends EventEmitter {
|
|
|
310
310
|
sensorReferenceTemperatureService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
311
311
|
.onGet(async () => {
|
|
312
312
|
const value = this.sensorsReferenceTemperature[i];
|
|
313
|
-
if (
|
|
313
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} reference temperature: ${value} °${this.tempUnit}`);
|
|
314
314
|
return value;
|
|
315
315
|
});
|
|
316
316
|
this.sensorReferenceTemperatureServices.push(sensorReferenceTemperatureService);
|
|
@@ -320,7 +320,7 @@ class Fans extends EventEmitter {
|
|
|
320
320
|
//object temperature
|
|
321
321
|
const sensorsObjTemperatureCount = this.sensorsObjTemperatureCount;
|
|
322
322
|
if (sensorsObjTemperatureCount > 0) {
|
|
323
|
-
if (this.
|
|
323
|
+
if (this.logDebug) this.emit('debug', `Prepare Obj Temperature Sensor Services`);
|
|
324
324
|
this.sensorObjTemperatureServices = [];
|
|
325
325
|
for (let i = 0; i < sensorsObjTemperatureCount; i++) {
|
|
326
326
|
const sensorName = this.sensorsName[i];
|
|
@@ -331,7 +331,7 @@ class Fans extends EventEmitter {
|
|
|
331
331
|
sensorObjTemperatureService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
332
332
|
.onGet(async () => {
|
|
333
333
|
const value = this.sensorsObjTemperature[i];
|
|
334
|
-
if (
|
|
334
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} obj temperature: ${value} °${this.tempUnit}`);
|
|
335
335
|
return value;
|
|
336
336
|
});
|
|
337
337
|
this.sensorObjTemperatureServices.push(sensorObjTemperatureService);
|
|
@@ -341,7 +341,7 @@ class Fans extends EventEmitter {
|
|
|
341
341
|
//ambient temperature
|
|
342
342
|
const sensorsAmbTemperatureCount = this.sensorsAmbTemperatureCount;
|
|
343
343
|
if (sensorsAmbTemperatureCount > 0) {
|
|
344
|
-
if (this.
|
|
344
|
+
if (this.logDebug) this.emit('debug', `Prepare Amb Temperature Sensor Services`);
|
|
345
345
|
this.sensorAmbTemperatureServices = [];
|
|
346
346
|
for (let i = 0; i < sensorsAmbTemperatureCount; i++) {
|
|
347
347
|
const sensorName = this.sensorsName[i];
|
|
@@ -352,7 +352,7 @@ class Fans extends EventEmitter {
|
|
|
352
352
|
sensorAmbTemperatureService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
353
353
|
.onGet(async () => {
|
|
354
354
|
const value = this.sensorsAmbTemperature[i];
|
|
355
|
-
if (
|
|
355
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} amb temperature: ${value} °${this.tempUnit}`);
|
|
356
356
|
return value;
|
|
357
357
|
});
|
|
358
358
|
this.sensorAmbTemperatureServices.push(sensorAmbTemperatureService);
|
|
@@ -362,7 +362,7 @@ class Fans extends EventEmitter {
|
|
|
362
362
|
//dew point temperature
|
|
363
363
|
const sensorsDewPointTemperatureCount = this.sensorsDewPointTemperatureCount;
|
|
364
364
|
if (sensorsDewPointTemperatureCount > 0) {
|
|
365
|
-
if (this.
|
|
365
|
+
if (this.logDebug) this.emit('debug', `Prepare Dew Point Temperature Sensor Services`);
|
|
366
366
|
this.sensorDewPointTemperatureServices = [];
|
|
367
367
|
for (let i = 0; i < sensorsDewPointTemperatureCount; i++) {
|
|
368
368
|
const sensorName = this.sensorsName[i];
|
|
@@ -373,7 +373,7 @@ class Fans extends EventEmitter {
|
|
|
373
373
|
sensorDewPointTemperatureService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
374
374
|
.onGet(async () => {
|
|
375
375
|
const value = this.sensorsDewPointTemperature[i];
|
|
376
|
-
if (
|
|
376
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} dew point: ${value} °${this.tempUnit}`);
|
|
377
377
|
return value;
|
|
378
378
|
});
|
|
379
379
|
this.sensorDewPointTemperatureServices.push(sensorDewPointTemperatureService);
|
|
@@ -383,7 +383,7 @@ class Fans extends EventEmitter {
|
|
|
383
383
|
//humidity
|
|
384
384
|
const sensorsHumidityCount = this.sensorsHumidityCount;
|
|
385
385
|
if (sensorsHumidityCount > 0) {
|
|
386
|
-
if (this.
|
|
386
|
+
if (this.logDebug) this.emit('debug', `Prepare Humidity Sensor Services`);
|
|
387
387
|
this.sensorHumidityServices = [];
|
|
388
388
|
for (let i = 0; i < sensorsHumidityCount; i++) {
|
|
389
389
|
const sensorName = this.sensorsName[i];
|
|
@@ -394,7 +394,7 @@ class Fans extends EventEmitter {
|
|
|
394
394
|
sensorHumidityService.getCharacteristic(Characteristic.CurrentRelativeHumidity)
|
|
395
395
|
.onGet(async () => {
|
|
396
396
|
const value = this.sensorsHumidity[i];
|
|
397
|
-
if (
|
|
397
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} humidity: ${value} %`);
|
|
398
398
|
return value;
|
|
399
399
|
});
|
|
400
400
|
this.sensorHumidityServices.push(sensorHumidityService);
|
|
@@ -408,7 +408,7 @@ class Fans extends EventEmitter {
|
|
|
408
408
|
//carbon dioxyde
|
|
409
409
|
const sensorsCarbonDioxydeCount = this.sensorsCarbonDioxydeCount;
|
|
410
410
|
if (sensorsCarbonDioxydeCount > 0) {
|
|
411
|
-
if (this.
|
|
411
|
+
if (this.logDebug) this.emit('debug', `Prepare Carbon Dioxyde Sensor Services`);
|
|
412
412
|
this.sensorCarbonDioxydeServices = [];
|
|
413
413
|
for (let i = 0; i < sensorsCarbonDioxydeCount; i++) {
|
|
414
414
|
const sensorName = this.sensorsName[i];
|
|
@@ -419,19 +419,19 @@ class Fans extends EventEmitter {
|
|
|
419
419
|
sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxideDetected)
|
|
420
420
|
.onGet(async () => {
|
|
421
421
|
const state = this.sensorsCarbonDioxyde[i] > 1000;
|
|
422
|
-
if (
|
|
422
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} carbon dioxyde detected: ${state ? 'Yes' : 'No'}`);
|
|
423
423
|
return state;
|
|
424
424
|
});
|
|
425
425
|
sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxideLevel)
|
|
426
426
|
.onGet(async () => {
|
|
427
427
|
const value = this.sensorsCarbonDioxyde[i];
|
|
428
|
-
if (
|
|
428
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} carbon dioxyde level: ${value} ppm`);
|
|
429
429
|
return value;
|
|
430
430
|
});
|
|
431
431
|
sensorCarbonDioxydeService.getCharacteristic(Characteristic.CarbonDioxidePeakLevel)
|
|
432
432
|
.onGet(async () => {
|
|
433
433
|
const value = this.sensorsCarbonDioxyde[i];
|
|
434
|
-
if (
|
|
434
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} carbon dioxyde peak level: ${value} ppm`);
|
|
435
435
|
return value;
|
|
436
436
|
});
|
|
437
437
|
this.sensorCarbonDioxydeServices.push(sensorCarbonDioxydeService);
|
|
@@ -441,7 +441,7 @@ class Fans extends EventEmitter {
|
|
|
441
441
|
//ambient light
|
|
442
442
|
const sensorsAmbientLightCount = this.sensorsAmbientLightCount;
|
|
443
443
|
if (sensorsAmbientLightCount > 0) {
|
|
444
|
-
if (this.
|
|
444
|
+
if (this.logDebug) this.emit('debug', `Prepare Ambient Light Sensor Services`);
|
|
445
445
|
this.sensorAmbientLightServices = [];
|
|
446
446
|
for (let i = 0; i < sensorsAmbientLightCount; i++) {
|
|
447
447
|
const sensorName = this.sensorsName[i];
|
|
@@ -452,7 +452,7 @@ class Fans extends EventEmitter {
|
|
|
452
452
|
sensorAmbientLightService.getCharacteristic(Characteristic.CurrentAmbientLightLevel)
|
|
453
453
|
.onGet(async () => {
|
|
454
454
|
const value = this.sensorsAmbientLight[i];
|
|
455
|
-
if (
|
|
455
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} ambient light: ${value} lx`);
|
|
456
456
|
return value;
|
|
457
457
|
});
|
|
458
458
|
this.sensorAmbientLightServices.push(sensorAmbientLightService);
|
|
@@ -462,7 +462,7 @@ class Fans extends EventEmitter {
|
|
|
462
462
|
//motion
|
|
463
463
|
const sensorsMotionCount = this.sensorsMotionCount;
|
|
464
464
|
if (sensorsMotionCount > 0) {
|
|
465
|
-
if (this.
|
|
465
|
+
if (this.logDebug) this.emit('debug', `Prepare Motion Sensor Services`);
|
|
466
466
|
this.sensorMotionServices = [];
|
|
467
467
|
for (let i = 0; i < sensorsMotionCount; i++) {
|
|
468
468
|
const sensorName = this.sensorsName[i];
|
|
@@ -473,7 +473,7 @@ class Fans extends EventEmitter {
|
|
|
473
473
|
sensorMotionService.getCharacteristic(Characteristic.MotionDetected)
|
|
474
474
|
.onGet(async () => {
|
|
475
475
|
const state = this.sensorsMotion[i];
|
|
476
|
-
if (
|
|
476
|
+
if (this.logInfo) this.emit('info', `sensor: ${sensorName} motion: ${state ? 'ON' : 'OFF'}`);
|
|
477
477
|
return state;
|
|
478
478
|
});
|
|
479
479
|
this.sensorMotionServices.push(sensorMotionService);
|
|
@@ -497,7 +497,7 @@ class Fans extends EventEmitter {
|
|
|
497
497
|
this.emit('success', `Connect Success`)
|
|
498
498
|
|
|
499
499
|
//check device info
|
|
500
|
-
if (
|
|
500
|
+
if (this.logDeviceInfo) await this.deviceInfo();
|
|
501
501
|
|
|
502
502
|
//start prepare accessory
|
|
503
503
|
const accessory = await this.prepareAccessory();
|