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.
- package/lib/parameter-checker.js +2 -0
- package/lib/switchbot-advertising.js +3 -2
- package/lib/switchbot-device-woblindtilt.js +3 -0
- package/lib/switchbot-device-wobulb.js +3 -0
- package/lib/switchbot-device-wocurtain.js +3 -0
- package/lib/switchbot-device-wohand.js +3 -0
- package/lib/switchbot-device-wohumi.js +3 -0
- package/lib/switchbot-device-woplugmini.js +3 -0
- package/lib/switchbot-device-wostrip.js +3 -0
- package/lib/switchbot-device.js +5 -2
- package/lib/switchbot.js +1 -1
- package/package.json +1 -1
package/lib/parameter-checker.js
CHANGED
|
@@ -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",
|
package/lib/switchbot-device.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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(
|
|
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