homey-api 3.4.14 → 3.4.16

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.
@@ -297,7 +297,7 @@ class HomeyAPIV3 extends HomeyAPI {
297
297
 
298
298
  // Ping localSecure (https://xxx-xxx-xxx-xx.homey.homeylocal.com)
299
299
  if (urls[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]) {
300
- pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE] = ping(HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE, 3000);
300
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE] = ping(HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE, 5000);
301
301
  pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE].catch(err => {
302
302
  this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE} Error:`, err && err.message)
303
303
  this.__debug(urls[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]);
@@ -630,6 +630,11 @@ class HomeyAPIV3 extends HomeyAPI {
630
630
  Promise.resolve().then(async () => {
631
631
  await this.connect();
632
632
  await Util.timeout(new Promise((resolve, reject) => {
633
+ if (this.isConnected() !== true) {
634
+ reject(new Error('Not connected after connect. (Reconnect)'));
635
+ return;
636
+ }
637
+
633
638
  this.__homeySocket.once('disconnect', (reason) => {
634
639
  reject(new Error(reason));
635
640
  });
@@ -834,7 +839,18 @@ class HomeyAPIV3 extends HomeyAPI {
834
839
  token: this.__token,
835
840
  homeyId: this.id,
836
841
  }, (err, result) => {
837
- if (err) return reject(err);
842
+ if (err) {
843
+ if (err instanceof Error) {
844
+ return reject(err)
845
+ }
846
+
847
+ if (typeof err === 'object') {
848
+ return reject(new Error(err.message));
849
+ }
850
+
851
+ return reject(new Error(String(err)));
852
+ }
853
+
838
854
  return resolve(result);
839
855
  });
840
856
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.4.14",
3
+ "version": "3.4.16",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [