@mschaeffler/node-red-bthome 0.4.4 → 0.5.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/bthome.js +15 -2
- package/package.json +1 -1
package/bthome.js
CHANGED
|
@@ -3,6 +3,13 @@ const Tools = require( './tools.js' );
|
|
|
3
3
|
const Rawdata = require( "./rawdata.js" );
|
|
4
4
|
const BtEvent = require( "./btevent.js" );
|
|
5
5
|
|
|
6
|
+
/*
|
|
7
|
+
const state2str = {
|
|
8
|
+
"514": ["close","open"],
|
|
9
|
+
"undefined": ["","near","middle","far"]
|
|
10
|
+
};
|
|
11
|
+
*/
|
|
12
|
+
|
|
6
13
|
module.exports = function(RED) {
|
|
7
14
|
|
|
8
15
|
function BtHomeNode(config) {
|
|
@@ -130,8 +137,11 @@ module.exports = function(RED) {
|
|
|
130
137
|
case 0x21:
|
|
131
138
|
events.pushEvent( "motion", rawdata.getEnum( ["","motion"] ) );
|
|
132
139
|
break;
|
|
140
|
+
case 0x2C:
|
|
141
|
+
setData( "vibration", Boolean( rawdata.getUInt8() ) );
|
|
142
|
+
break;
|
|
133
143
|
case 0x2D:
|
|
134
|
-
setData( "state", rawdata.
|
|
144
|
+
setData( "state", rawdata.getUInt8() );
|
|
135
145
|
break;
|
|
136
146
|
case 0x2E:
|
|
137
147
|
setData( "humidity", rawdata.getUInt8() );
|
|
@@ -142,6 +152,9 @@ module.exports = function(RED) {
|
|
|
142
152
|
case 0x3F:
|
|
143
153
|
setData( "tilt", rawdata.getInt16() * 0.1 );
|
|
144
154
|
break;
|
|
155
|
+
case 0x40:
|
|
156
|
+
setData( "distance", rawdata.getUInt16() );
|
|
157
|
+
break;
|
|
145
158
|
case 0x45:
|
|
146
159
|
setData( "temperature", rawdata.getInt16() * 0.1 );
|
|
147
160
|
break;
|
|
@@ -233,7 +246,7 @@ module.exports = function(RED) {
|
|
|
233
246
|
}
|
|
234
247
|
if( item == undefined )
|
|
235
248
|
{
|
|
236
|
-
item = { pid: null, gw: {} };
|
|
249
|
+
item = { pid: null, typeId: null, gw: {} };
|
|
237
250
|
node.data[name] = item;
|
|
238
251
|
}
|
|
239
252
|
decodeMsg();
|