homebridge-tasmota-control 1.8.0-beta.1 → 1.8.0-beta.3
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 +47 -41
- package/index.js +13 -13
- package/package.json +1 -1
- package/src/deviceinfo.js +4 -4
- 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
|
@@ -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": [
|
|
@@ -1477,7 +1483,7 @@
|
|
|
1477
1483
|
{
|
|
1478
1484
|
"key": "devices",
|
|
1479
1485
|
"type": "tabarray",
|
|
1480
|
-
"title": "{{ value.name || '
|
|
1486
|
+
"title": "{{ value.name || 'Device' }}",
|
|
1481
1487
|
"items": [
|
|
1482
1488
|
"devices[].name",
|
|
1483
1489
|
"devices[].host",
|
|
@@ -1529,7 +1535,7 @@
|
|
|
1529
1535
|
{
|
|
1530
1536
|
"key": "devices[].miElHvac.presets",
|
|
1531
1537
|
"type": "tabarray",
|
|
1532
|
-
"title": "{{ value.name || '
|
|
1538
|
+
"title": "{{ value.name || 'Preset'}}",
|
|
1533
1539
|
"items": [
|
|
1534
1540
|
"devices[].miElHvac.presets[].displayType",
|
|
1535
1541
|
"devices[].miElHvac.presets[].name",
|
|
@@ -1553,7 +1559,7 @@
|
|
|
1553
1559
|
{
|
|
1554
1560
|
"key": "devices[].miElHvac.buttons",
|
|
1555
1561
|
"type": "tabarray",
|
|
1556
|
-
"title": "{{ value.name || '
|
|
1562
|
+
"title": "{{ value.name || 'Button' }}",
|
|
1557
1563
|
"items": [
|
|
1558
1564
|
"devices[].miElHvac.buttons[].displayType",
|
|
1559
1565
|
"devices[].miElHvac.buttons[].name",
|
|
@@ -1575,7 +1581,7 @@
|
|
|
1575
1581
|
{
|
|
1576
1582
|
"key": "devices[].miElHvac.sensors",
|
|
1577
1583
|
"type": "tabarray",
|
|
1578
|
-
"title": "{{ value.name || '
|
|
1584
|
+
"title": "{{ value.name || 'Sensor' }}",
|
|
1579
1585
|
"items": [
|
|
1580
1586
|
"devices[].miElHvac.sensors[].displayType",
|
|
1581
1587
|
"devices[].miElHvac.sensors[].name",
|
|
@@ -1649,15 +1655,15 @@
|
|
|
1649
1655
|
]
|
|
1650
1656
|
},
|
|
1651
1657
|
{
|
|
1652
|
-
"key": "devices[]",
|
|
1658
|
+
"key": "devices[].log",
|
|
1653
1659
|
"title": "Log",
|
|
1654
1660
|
"items": [
|
|
1655
|
-
"devices[].
|
|
1656
|
-
"devices[].
|
|
1657
|
-
"devices[].
|
|
1658
|
-
"devices[].
|
|
1659
|
-
"devices[].
|
|
1660
|
-
"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"
|
|
1661
1667
|
]
|
|
1662
1668
|
}
|
|
1663
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
package/src/deviceinfo.js
CHANGED
|
@@ -3,11 +3,11 @@ import EventEmitter from 'events';
|
|
|
3
3
|
import { ApiCommands, LightKeys, SensorKeys } from './constants.js';
|
|
4
4
|
|
|
5
5
|
class DeviceInfo extends EventEmitter {
|
|
6
|
-
constructor(url, auth, user, passwd, deviceName, loadNameFromDevice,
|
|
6
|
+
constructor(url, auth, user, passwd, deviceName, loadNameFromDevice, logDebug) {
|
|
7
7
|
super();
|
|
8
8
|
this.name = deviceName
|
|
9
9
|
this.loadNameFromDevice = loadNameFromDevice;
|
|
10
|
-
this.
|
|
10
|
+
this.logDebug = logDebug;
|
|
11
11
|
|
|
12
12
|
//axios instance
|
|
13
13
|
this.client = axios.create({
|
|
@@ -23,11 +23,11 @@ class DeviceInfo extends EventEmitter {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async getInfo() {
|
|
26
|
-
if (this.
|
|
26
|
+
if (this.logDebug) this.emit('debug', `Requesting info`);
|
|
27
27
|
try {
|
|
28
28
|
const deviceInfoData = await this.client.get(ApiCommands.Status);
|
|
29
29
|
const deviceInfo = deviceInfoData.data ?? {};
|
|
30
|
-
if (this.
|
|
30
|
+
if (this.logDebug) this.emit('debug', `Info: ${JSON.stringify(deviceInfo, null, 2)}`);
|
|
31
31
|
await new Promise(resolve => setTimeout(resolve, 250));
|
|
32
32
|
|
|
33
33
|
//status
|
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 = config.log?.deviceInfo || false;
|
|
26
|
+
this.logInfo = config.log?.info || false;
|
|
27
|
+
this.logDebug = config.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();
|