node-switchbot 1.5.0 → 1.6.0-beta.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.
- package/lib/switchbot-advertising.js +44 -58
- package/package.json +3 -3
|
@@ -360,40 +360,35 @@ class SwitchbotAdvertising {
|
|
|
360
360
|
}
|
|
361
361
|
return null;
|
|
362
362
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
363
|
+
|
|
364
|
+
const byte6 = buf.readUInt8(6);
|
|
365
|
+
const byte7 = buf.readUInt8(7);
|
|
366
|
+
const byte8 = buf.readUInt8(8);
|
|
367
|
+
const byte9 = buf.readUInt8(9);
|
|
368
|
+
const byte10 = buf.readUInt8(10);
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
const sequence_number = byte6;
|
|
372
|
+
const isOn = byte7 & 0b01111111 ? true : false;
|
|
373
|
+
const brightness = byte7 & 0b01111111;
|
|
374
|
+
const delay = byte8 & 0b10000000;
|
|
375
|
+
const preset = byte8 & 0b00001000;
|
|
376
|
+
const color_mode = byte8 & 0b00000111;
|
|
377
|
+
const speed = byte9 & 0b01111111;
|
|
378
|
+
const loop_index = byte10 & 0b11111110;
|
|
378
379
|
|
|
379
380
|
const data = {
|
|
380
381
|
model: "u",
|
|
381
382
|
modelName: "WoBulb",
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
model: "u",
|
|
386
|
-
modelName: "WoBulb",
|
|
387
|
-
state: state,
|
|
388
|
-
lightLevel: lightLevel,
|
|
383
|
+
sequence_number: sequence_number,
|
|
384
|
+
isOn: isOn,
|
|
385
|
+
brightness: brightness,
|
|
389
386
|
delay: delay,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
loopIndex: loopIndex,
|
|
396
|
-
};*/
|
|
387
|
+
preset: preset,
|
|
388
|
+
color_mode: color_mode,
|
|
389
|
+
speed: speed,
|
|
390
|
+
loop_index: loop_index,
|
|
391
|
+
};
|
|
397
392
|
|
|
398
393
|
return data;
|
|
399
394
|
}
|
|
@@ -549,40 +544,31 @@ class SwitchbotAdvertising {
|
|
|
549
544
|
}
|
|
550
545
|
return null;
|
|
551
546
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
//const dynamicRate = !!(byte12 & 0b10000000);
|
|
566
|
-
//const loopIndex = (((byte12 & 0b01111111) << 8) + byte13) / 10; // in watt
|
|
547
|
+
|
|
548
|
+
const byte7 = buf.readUInt8(7);
|
|
549
|
+
const byte8 = buf.readUInt8(8);
|
|
550
|
+
const byte9 = buf.readUInt8(9);
|
|
551
|
+
const byte10 = buf.readUInt8(10);
|
|
552
|
+
|
|
553
|
+
const isOn = byte7 & 0b10000000 ? true : false;
|
|
554
|
+
const brightness = byte7 & 0b01111111;
|
|
555
|
+
const delay = byte8 & 0b10000000;
|
|
556
|
+
const preset = byte8 & 0b00001000;
|
|
557
|
+
const color_mode = byte8 & 0b00000111;
|
|
558
|
+
const speed = byte9 & 0b01111111;
|
|
559
|
+
const loop_index = byte10 & 0b11111110;
|
|
567
560
|
|
|
568
561
|
const data = {
|
|
569
562
|
model: "r",
|
|
570
563
|
modelName: "WoStrip",
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
/* const data = {
|
|
574
|
-
model: "u",
|
|
575
|
-
modelName: "WoBulb",
|
|
576
|
-
state: state,
|
|
577
|
-
lightLevel: lightLevel,
|
|
564
|
+
isOn: isOn,
|
|
565
|
+
brightness: brightness,
|
|
578
566
|
delay: delay,
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
loopIndex: loopIndex,
|
|
585
|
-
};*/
|
|
567
|
+
preset: preset,
|
|
568
|
+
color_mode: color_mode,
|
|
569
|
+
speed: speed,
|
|
570
|
+
loop_index: loop_index,
|
|
571
|
+
};
|
|
586
572
|
|
|
587
573
|
return data;
|
|
588
574
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-switchbot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-beta.1",
|
|
4
4
|
"description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).",
|
|
5
5
|
"main": "./lib/switchbot.js",
|
|
6
6
|
"files": [
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"@abandonware/noble": "^1.9.2-15"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"npm-check-updates": "^16.3.
|
|
40
|
+
"npm-check-updates": "^16.3.13"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|