node-switchbot 1.8.2-beta.2 → 1.8.2-beta.4

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.
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ const { Buffer } = require('buffer');
4
+
3
5
  class ParameterChecker {
4
6
  constructor() {
5
7
  this._error = null;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ const { Buffer } = require('buffer');
4
+
3
5
  class SwitchbotAdvertising {
4
6
  constructor() {}
5
7
 
@@ -595,8 +597,7 @@ class SwitchbotAdvertising {
595
597
 
596
598
  const temp_sign = byte4 & 0b10000000 ? 1 : -1;
597
599
  const temp_c = temp_sign * ((byte4 & 0b01111111) + (byte3 & 0b00001111) / 10);
598
- const temp_f = (temp_c * 9 / 5) + 32;
599
- temp_f = Math.round(temp_f * 10) / 10;
600
+ const temp_f = Math.round(((temp_c * 9 / 5) + 32) * 10) / 10;
600
601
 
601
602
  const data = {
602
603
  model: "i",
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  let SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  class SwitchbotDeviceWoBlindTilt extends SwitchbotDevice {
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  /**
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  class SwitchbotDeviceWoCurtain extends SwitchbotDevice {
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  class SwitchbotDeviceWoHand extends SwitchbotDevice {
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  class SwitchbotDeviceWoHumi extends SwitchbotDevice {
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  /**
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const SwitchbotDevice = require("./switchbot-device.js");
3
6
 
4
7
  /**
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+
3
+ const { Buffer } = require('buffer');
4
+
2
5
  const parameterChecker = require("./parameter-checker.js");
3
6
  const switchbotAdvertising = require("./switchbot-advertising.js");
4
7
 
@@ -330,7 +333,7 @@ class SwitchbotDevice {
330
333
 
331
334
  _disconnect() {
332
335
  if (this._was_connected_explicitly) {
333
- return new Promise((resolve, reject) => {
336
+ return new Promise((resolve) => {
334
337
  resolve();
335
338
  });
336
339
  } else {
@@ -351,7 +354,7 @@ class SwitchbotDevice {
351
354
  * ---------------------------------------------------------------- */
352
355
  getDeviceName() {
353
356
  return new Promise((resolve, reject) => {
354
- const name = "";
357
+ let name = "";
355
358
  this._connect()
356
359
  .then(() => {
357
360
  if (!this._chars.device) {
package/lib/switchbot.js CHANGED
@@ -279,7 +279,7 @@ class Switchbot {
279
279
  return false;
280
280
  }
281
281
  if (id) {
282
- id = id.toLowerCase().replace(/\:/g, "");
282
+ id = id.toLowerCase().replace(/:/g, "");
283
283
  const ad_id = ad.address.toLowerCase().replace(/[^a-z0-9]/g, "");
284
284
  if (ad_id !== id) {
285
285
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-switchbot",
3
- "version": "1.8.2-beta.2",
3
+ "version": "1.8.2-beta.4",
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": [