node-switchbot 1.7.2 → 1.7.3-beta.0

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.
@@ -443,6 +443,9 @@ class SwitchbotDevice {
443
443
 
444
444
  this._connect()
445
445
  .then(() => {
446
+ if (!this._chars) {
447
+ return reject("No characteristics available.");
448
+ }
446
449
  return this._write(this._chars.write, req_buf);
447
450
  })
448
451
  .then(() => {
package/lib/switchbot.js CHANGED
@@ -132,7 +132,9 @@ class Switchbot {
132
132
  for (let addr in peripherals) {
133
133
  device_list.push(peripherals[addr]);
134
134
  }
135
- resolve(device_list);
135
+ if (device_list.length) {
136
+ resolve(device_list);
137
+ }
136
138
  };
137
139
 
138
140
  // Set a handler for the 'discover' event
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-switchbot",
3
- "version": "1.7.2",
3
+ "version": "1.7.3-beta.0",
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": [
@@ -39,4 +39,4 @@
39
39
  "devDependencies": {
40
40
  "npm-check-updates": "^16.6.2"
41
41
  }
42
- }
42
+ }