node-switchbot 1.5.0 → 1.6.0-beta.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/lib/switchbot-advertising.js +19 -28
- package/package.json +2 -2
|
@@ -549,40 +549,31 @@ class SwitchbotAdvertising {
|
|
|
549
549
|
}
|
|
550
550
|
return null;
|
|
551
551
|
}
|
|
552
|
-
const byte9 = buf.readUInt8(9); // byte9: color bulb state; 0x00=off, 0x80=on & lightLevel: 1~100%
|
|
553
|
-
//const byte10 = buf.readUInt8(10); // byte10: bit0: 0=no delay,1=delay, bit1:0=no timer, 1=timer; bit2:0=no sync time, 1=sync'ed time
|
|
554
|
-
//const byte11 = buf.readUInt8(11); // byte11: wifi rssi
|
|
555
|
-
//const byte12 = buf.readUInt8(12); // byte12: bit7: overload?
|
|
556
|
-
//const byte13 = buf.readUInt8(13); // byte12[bit0~6] + byte13: current power value
|
|
557
552
|
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
553
|
+
const byte7 = buf.readUInt8(7);
|
|
554
|
+
const byte8 = buf.readUInt8(8);
|
|
555
|
+
const byte9 = buf.readUInt8(9);
|
|
556
|
+
const byte10 = buf.readUInt8(10);
|
|
557
|
+
|
|
558
|
+
const isOn = byte7 & 0b10000000;
|
|
559
|
+
const brightness = byte7 & 0b01111111;
|
|
560
|
+
const delay = byte8 & 0b10000000;
|
|
561
|
+
const preset = byte8 & 0b00001000;
|
|
562
|
+
const color_mode = byte8 & 0b00000111;
|
|
563
|
+
const speed = byte9 & 0b01111111;
|
|
564
|
+
const loop_index = byte10 & 0b11111110;
|
|
567
565
|
|
|
568
566
|
const data = {
|
|
569
567
|
model: "r",
|
|
570
568
|
modelName: "WoStrip",
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
/* const data = {
|
|
574
|
-
model: "u",
|
|
575
|
-
modelName: "WoBulb",
|
|
576
|
-
state: state,
|
|
577
|
-
lightLevel: lightLevel,
|
|
569
|
+
isOn: isOn,
|
|
570
|
+
brightness: brightness,
|
|
578
571
|
delay: delay,
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
loopIndex: loopIndex,
|
|
585
|
-
};*/
|
|
572
|
+
preset: preset,
|
|
573
|
+
color_mode: color_mode,
|
|
574
|
+
speed: speed,
|
|
575
|
+
loop_index: loop_index,
|
|
576
|
+
};
|
|
586
577
|
|
|
587
578
|
return data;
|
|
588
579
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-switchbot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-beta.0",
|
|
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": [
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"npm-check-updates": "^16.3.8"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|