node-switchbot
Advanced tools
Comparing version 1.4.2-beta.8 to 1.4.2-beta.9
@@ -355,6 +355,6 @@ "use strict"; | ||
_parseServiceDataForWoBulb(buf, onlog) { | ||
if (buf.length !== 6) { | ||
if (buf.length !== 13) { | ||
if (onlog && typeof onlog === "function") { | ||
onlog( | ||
`[_parseServiceDataForWoBulb] Buffer length ${buf.length} !== 6!` | ||
`[_parseServiceDataForWoBulb] Buffer length ${buf.length} !== 13!` | ||
); | ||
@@ -370,4 +370,4 @@ } | ||
const state = byte9 === 0x00 ? "off" : byte9 === 0x80 ? "on" : null; | ||
const lightLevel = byte9 & 0b01111111; | ||
const state = byte9 === 0x01 ? "off" : byte9 === 0x80 ? "on" : null; | ||
const lightLevel = byte9 & 0b00000011; | ||
const delay = !!(byte10 & 0b00000001); | ||
@@ -380,3 +380,2 @@ const networkStatus = !!(byte10 & 0b00000001); | ||
const loopIndex = (((byte12 & 0b01111111) << 8) + byte13) / 10; // in watt | ||
// TODO: voltage ??? | ||
@@ -387,2 +386,7 @@ const data = { | ||
state: state, | ||
}; | ||
/* const data = { | ||
model: "u", | ||
modelName: "WoBulb", | ||
state: state, | ||
lightLevel: lightLevel, | ||
@@ -396,3 +400,3 @@ delay: delay, | ||
loopIndex: loopIndex, | ||
}; | ||
};*/ | ||
@@ -399,0 +403,0 @@ return data; |
{ | ||
"name": "node-switchbot", | ||
"version": "1.4.2-beta.8", | ||
"version": "1.4.2-beta.9", | ||
"description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).", | ||
@@ -5,0 +5,0 @@ "main": "./lib/switchbot.js", |
136648
2435