homebridge-tasmota-control 1.5.1-beta.1 → 1.5.1-beta.10
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 +3 -0
- package/package.json +1 -1
- package/src/deviceinfo.js +7 -1
- package/src/sensors.js +6 -4
package/index.js
CHANGED
|
@@ -70,6 +70,9 @@ class tasmotaPlatform {
|
|
|
70
70
|
deviceInfo.on('debug', (debug) => {
|
|
71
71
|
const emitLog = !enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
72
72
|
})
|
|
73
|
+
.on('debug', (debug) => {
|
|
74
|
+
const emitLog = enableDebugMode ? false : log.info(`Device: ${host} ${deviceName}, debug: ${debug}.`);
|
|
75
|
+
})
|
|
73
76
|
.on('warn', (warn) => {
|
|
74
77
|
const emitLog = disableLogWarn ? false : log.warn(`Device: ${host} ${deviceName}, ${warn}.`);
|
|
75
78
|
})
|
package/package.json
CHANGED
package/src/deviceinfo.js
CHANGED
|
@@ -54,7 +54,11 @@ class DeviceInfo extends EventEmitter {
|
|
|
54
54
|
//status SNS
|
|
55
55
|
const statusSns = deviceInfo.StatusSNS ?? {};
|
|
56
56
|
const statusSnsKeys = Object.keys(statusSns);
|
|
57
|
-
|
|
57
|
+
const sensorName = Object.entries(statusSns)
|
|
58
|
+
.filter(([key]) => SensorKeys.some(type => key.includes(type)))
|
|
59
|
+
.reduce((obj, [key, value]) => {
|
|
60
|
+
return key;
|
|
61
|
+
}, {});
|
|
58
62
|
|
|
59
63
|
//status STS
|
|
60
64
|
const statusSts = deviceInfo.StatusSTS ?? {};
|
|
@@ -70,11 +74,13 @@ class DeviceInfo extends EventEmitter {
|
|
|
70
74
|
const obj = {
|
|
71
75
|
deviceTypes: types,
|
|
72
76
|
deviceName: deviceName,
|
|
77
|
+
sensorName: sensorName,
|
|
73
78
|
friendlyNames: friendlyNames,
|
|
74
79
|
modelName: modelName,
|
|
75
80
|
serialNumber: addressMac,
|
|
76
81
|
firmwareRevision: firmwareRevision
|
|
77
82
|
};
|
|
83
|
+
this.emit('debug', `Sensor: ${JSON.stringify(obj, null, 2)}`)
|
|
78
84
|
return obj;
|
|
79
85
|
} catch (error) {
|
|
80
86
|
throw new Error(`Check info error: ${error}`);
|
package/src/sensors.js
CHANGED
|
@@ -101,9 +101,8 @@ class Sensors extends EventEmitter {
|
|
|
101
101
|
const obj = {
|
|
102
102
|
name: key,
|
|
103
103
|
time: sensorStatus.Time,
|
|
104
|
-
tempUnit: sensorStatus.TempUnit
|
|
105
|
-
pressureUnit: sensorStatus.PressureUnit
|
|
106
|
-
|
|
104
|
+
tempUnit: sensorStatus.TempUnit,
|
|
105
|
+
pressureUnit: sensorStatus.PressureUnit,
|
|
107
106
|
temperature: sensorData.Temperature,
|
|
108
107
|
referenceTemperature: sensorData.ReferenceTemperature,
|
|
109
108
|
objTemperature: sensorData.OBJTMP,
|
|
@@ -114,7 +113,10 @@ class Sensors extends EventEmitter {
|
|
|
114
113
|
gas: sensorData.Gas,
|
|
115
114
|
carbonDioxyde: sensorData.CarbonDioxyde,
|
|
116
115
|
ambientLight: sensorData.Ambient,
|
|
117
|
-
motion: sensorData.Motion
|
|
116
|
+
motion: sensorData.Motion
|
|
117
|
+
}
|
|
118
|
+
if (obj.tempUnit === 'C') {
|
|
119
|
+
obj.tempUnit = '°C';
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
//energy
|