@mschaeffler/node-red-bthome 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/bthome.js +6 -8
  2. package/package.json +1 -1
package/bthome.js CHANGED
@@ -3,13 +3,6 @@ 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
-
13
6
  module.exports = function(RED) {
14
7
 
15
8
  function BtHomeNode(config) {
@@ -141,7 +134,12 @@ module.exports = function(RED) {
141
134
  setData( "vibration", Boolean( rawdata.getUInt8() ) );
142
135
  break;
143
136
  case 0x2D:
144
- setData( "state", rawdata.getUInt8() );
137
+ let state = rawdata.getUInt8();
138
+ if( item.typeId === 0x0202 )
139
+ {
140
+ state = Boolean( state );
141
+ }
142
+ setData( "state", state );
145
143
  break;
146
144
  case 0x2E:
147
145
  setData( "humidity", rawdata.getUInt8() );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-bthome",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "A Node Red node to decrypt and decode BT-Home frames",
5
5
  "author": {
6
6
  "name": "Mathias Schäffler",