Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-switchbot

Package Overview
Dependencies
Maintainers
2
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-switchbot - npm Package Compare versions

Comparing version 1.0.9-beta.1 to 1.0.9-beta.2

75

lib/switchbot-advertising.js

@@ -81,4 +81,2 @@ 'use strict';

sd = this._parseServiceDataForWoHand(buf);
} else if (model === 'h') { // WoHumi
sd = this._parseServiceDataForWoHumi(buf);
} else if (model === 'T') { // WoSensorTH

@@ -145,22 +143,2 @@ sd = this._parseServiceDataForWoSensorTH(buf);

_parseServiceDataForWoHumi(buf) {
if (buf.length !== 3) {
return null;
}
let byte1 = buf.readUInt8(1);
let byte2 = buf.readUInt8(2);
let mode = (byte1 & 0b10000000) ? true : false; // Whether the light switch Add-on is used or not
let state = (byte1 & 0b01000000) ? true : false; // Whether the switch status is ON or OFF
let data = {
model: 'h',
modelName: 'WoHumi',
mode: mode,
state: state
};
return data;
}
_parseServiceDataForWoSensorTH(buf) {

@@ -200,6 +178,22 @@ if (buf.length !== 6) {

let data = {
model: 'P',
const byte1 = buf.readUInt8(1);
const byte2 = buf.readUInt8(2);
const byte3 = buf.readUInt8(3);
const byte4 = buf.readUInt8(4);
const byte5 = buf.readUInt8(5);
const motion = byte1 & 0b01000000; // Whether the calibration is completed
const battery = byte2 & 0b01111111; // %
const pir_trigger3 = byte3 & 0b00001111; //
const pir_trigger4 = byte4 & 0b01000000; //
const state = byte5 & 0b01111111; // %
const data = {
model: 's',
modelName: 'WoPresence',
battery: (byte2 & 0b01111111)
motion: motion ? true : false,
battery: battery,
pir_trigger3: pir_trigger3,
pir_trigger4: pir_trigger4,
state: state ? true : false,
};

@@ -215,6 +209,31 @@

let data = {
model: 'C',
const byte1 = buf.readUInt8(1);
const byte2 = buf.readUInt8(2);
const byte3 = buf.readUInt8(3);
const byte4 = buf.readUInt8(4);
const byte5 = buf.readUInt8(5);
const byte6 = buf.readUInt8(6);
const byte7 = buf.readUInt8(7);
const byte8 = buf.readUInt8(8);
const motion = byte1 & 0b01000000; // Whether there is motion
const battery = byte2 & 0b01111111; // %
const state = byte3 & 0b01111111; // current state
const pir_trigger4 = byte4 & 0b00001111; //
const pir_trigger5 = byte5 & 0b01000000; //
const hal_trigger6 = byte6 & 0b01111111; //
const hal_trigger7 = byte7 & 0b01111111; //
const act_counter = byte8 & 0b00001111; //
const data = {
model: 'd',
modelName: 'WoContact',
battery: (byte2 & 0b01111111)
motion: motion ? true : false,
battery: battery,
state: state ? true : false,
pir_trigger4: pir_trigger4,
pir_trigger5: pir_trigger5,
hal_trigger6: hal_trigger6,
hal_trigger7: hal_trigger7,
act_counter: act_counter,
};

@@ -221,0 +240,0 @@

@@ -11,3 +11,2 @@ 'use strict';

const SwitchbotDeviceWoSensorTH = require('./switchbot-device-wosensorth.js');
const SwitchbotDeviceWoHumi = require('./switchbot-device-wohumi.js');

@@ -188,5 +187,2 @@ class Switchbot {

break;
case 'Hu':
device = new SwitchbotDeviceWoHumi(peripheral, this.noble);
break;
case 'T':

@@ -193,0 +189,0 @@ device = new SwitchbotDeviceWoSensorTH(peripheral, this.noble);

{
"name": "node-switchbot",
"version": "1.0.9-beta.1",
"version": "1.0.9-beta.2",
"description": "The node-switchbot is a Node.js module which allows you to move your Switchbot (Bot)'s arm and Switchbot Curtain(Curtain), also monitor the temperature/humidity from SwitchBot Thermometer & Hygrometer (Meter).",

@@ -5,0 +5,0 @@ "main": "./lib/switchbot.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc