node-switchbot
Advanced tools
Comparing version
@@ -86,37 +86,25 @@ "use strict"; | ||
if (model === "H") { | ||
// WoHand | ||
sd = this._parseServiceDataForWoHand(buf, onlog); | ||
sd = this._parseServiceDataForWoHand(buf, onlog);//WoHand | ||
} else if (model === "T") { | ||
// WoSensorTH | ||
sd = this._parseServiceDataForWoSensorTH(buf, onlog); | ||
sd = this._parseServiceDataForWoSensorTH(buf, onlog);//WoSensorTH | ||
} else if (model === "e") { | ||
// WoHumi | ||
sd = this._parseServiceDataForWoHumi(buf, onlog); | ||
sd = this._parseServiceDataForWoHumi(buf, onlog);//WoHumi | ||
} else if (model === "s") { | ||
// WoMotion | ||
sd = this._parseServiceDataForWoPresence(buf, onlog); | ||
sd = this._parseServiceDataForWoPresence(buf, onlog);//WoPresence | ||
} else if (model === "d") { | ||
// WoContact | ||
sd = this._parseServiceDataForWoContact(buf, onlog); | ||
sd = this._parseServiceDataForWoContact(buf, onlog);//WoContact | ||
} else if (model === "c") { | ||
// WoCurtain | ||
sd = this._parseServiceDataForWoCurtain(buf, onlog); | ||
sd = this._parseServiceDataForWoCurtain(buf, onlog);// WoCurtain | ||
} else if (model === "u") { | ||
// WoColorBulb | ||
sd = this._parseServiceDataForWoColorBulb(buf, onlog); | ||
sd = this._parseServiceDataForWoBulb(manufacturerData, onlog);// WoBulb | ||
} else if (model === "g") { | ||
// WoPlugMini (US) | ||
sd = this._parseServiceDataForWoPlugMiniUS(manufacturerData, onlog); | ||
sd = this._parseServiceDataForWoPlugMiniUS(manufacturerData, onlog); // WoPlugMini (US) | ||
} else if (model === "j") { | ||
// WoPlugMini (JP) | ||
sd = this._parseServiceDataForWoPlugMiniJP(manufacturerData, onlog); | ||
sd = this._parseServiceDataForWoPlugMiniJP(manufacturerData, onlog);// WoPlugMini (JP) | ||
} else if (model === "o") { | ||
// WoSmartLock | ||
sd = this._parseServiceDataForWoSmartLock(buf, onlog); | ||
sd = this._parseServiceDataForWoSmartLock(buf, onlog);// WoSmartLock | ||
} else if (model === "i") { | ||
// WoMeterPlus | ||
sd = this._parseServiceDataForWoSensorTHPlus(buf, onlog); | ||
sd = this._parseServiceDataForWoSensorTHPlus(buf, onlog);// WoMeterPlus | ||
} else if (model === "r") { | ||
// WoLEDStripLight | ||
sd = this._parseServiceDataForWoLEDStripLight(buf, onlog); | ||
sd = this._parseServiceDataForWoStrip(buf, onlog);// WoStrip | ||
} else { | ||
@@ -367,7 +355,7 @@ if (onlog && typeof onlog === "function") { | ||
_parseServiceDataForWoColorBulb(buf, onlog) { | ||
_parseServiceDataForWoBulb(buf, onlog) { | ||
if (buf.length !== 6) { | ||
if (onlog && typeof onlog === "function") { | ||
onlog( | ||
`[_parseServiceDataForWoColorBulb] Buffer length ${buf.length} !== 6!` | ||
`[_parseServiceDataForWoBulb] Buffer length ${buf.length} !== 6!` | ||
); | ||
@@ -396,3 +384,3 @@ } | ||
model: "u", | ||
modelName: "WoColorBulb", | ||
modelName: "WoBulb", | ||
state: state, | ||
@@ -399,0 +387,0 @@ lightLevel: lightLevel, |
@@ -13,3 +13,4 @@ "use strict"; | ||
const SwitchbotDeviceWoPlugMini = require("./switchbot-device-woplugmini.js"); | ||
const SwitchbotDeviceWoColorBulb = require("./switchbot-device-wocolorbulb.js"); | ||
const SwitchbotDeviceWoBulb = require("./switchbot-device-wobulb.js"); | ||
const SwitchbotDeviceWoStrip = require("./switchbot-device-wostrip.js"); | ||
@@ -231,3 +232,3 @@ class Switchbot { | ||
case "u": | ||
device = new SwitchbotDeviceWoColorBulb(peripheral, this.noble); | ||
device = new SwitchbotDeviceWoBulb(peripheral, this.noble); | ||
break; | ||
@@ -245,3 +246,3 @@ case "g": | ||
case "r": | ||
device = new SwitchbotDeviceWoLEDStripLight(peripheral, this.noble); | ||
device = new SwitchbotDeviceWoStrip(peripheral, this.noble); | ||
break; | ||
@@ -248,0 +249,0 @@ default: // 'resetting', 'unknown' |
{ | ||
"name": "node-switchbot", | ||
"version": "1.4.2-beta.6", | ||
"version": "1.4.2-beta.7", | ||
"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", |
136575
1.54%17
6.25%2431
2.66%