homey-api 3.4.13 → 3.4.15

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.
@@ -34,20 +34,20 @@ class Flow extends FlowV3 {
34
34
  static transformSet(item) {
35
35
  if (item.trigger) {
36
36
  item.trigger.uri = item.trigger.id.split(':', 3).join(':');
37
- item.trigger.id = item.trigger.id.split(':').reverse()[0];
37
+ item.trigger.id = item.trigger.id.split(':').slice(3).join(':');
38
38
  }
39
39
 
40
40
  if (Array.isArray(item.conditions)) {
41
41
  item.conditions.forEach(card => {
42
42
  card.uri = card.id.split(':', 3).join(':');
43
- card.id = card.id.split(':').reverse()[0];
43
+ card.id = card.id.split(':').slice(3).join(':');
44
44
  });
45
45
  }
46
46
 
47
47
  if (Array.isArray(item.actions)) {
48
48
  item.actions.forEach(card => {
49
49
  card.uri = card.id.split(':', 3).join(':');
50
- card.id = card.id.split(':').reverse()[0];
50
+ card.id = card.id.split(':').slice(3).join(':');
51
51
  });
52
52
  }
53
53
 
@@ -67,7 +67,7 @@ class ManagerFlow extends ManagerFlowV3 {
67
67
  }
68
68
 
69
69
  return this.__super__getFlowCardTrigger({
70
- id: id.split(':').reverse()[0],
70
+ id: id.split(':').slice(3).join(':'),
71
71
  uri: id.split(':', 3).join(':'),
72
72
  });
73
73
  }
@@ -81,7 +81,7 @@ class ManagerFlow extends ManagerFlowV3 {
81
81
  }
82
82
 
83
83
  return this.__super__getFlowCardCondition({
84
- id: id.split(':').reverse()[0],
84
+ id: id.split(':').slice(3).join(':'),
85
85
  uri: id.split(':', 3).join(':'),
86
86
  });
87
87
  }
@@ -91,7 +91,7 @@ class ManagerFlow extends ManagerFlowV3 {
91
91
  ...props
92
92
  }) {
93
93
  return this.__super__runFlowCardCondition({
94
- id: id.split(':').reverse()[0],
94
+ id: id.split(':').slice(3).join(':'),
95
95
  uri: id.split(':', 3).join(':'),
96
96
  ...props,
97
97
  });
@@ -106,7 +106,7 @@ class ManagerFlow extends ManagerFlowV3 {
106
106
  }
107
107
 
108
108
  return this.__super__getFlowCardAction({
109
- id: id.split(':').reverse()[0],
109
+ id: id.split(':').slice(3).join(':'),
110
110
  uri: id.split(':', 3).join(':'),
111
111
  });
112
112
  }
@@ -116,7 +116,7 @@ class ManagerFlow extends ManagerFlowV3 {
116
116
  ...props
117
117
  }) {
118
118
  return this.__super__runFlowCardAction({
119
- id: id.split(':').reverse()[0],
119
+ id: id.split(':').slice(3).join(':'),
120
120
  uri: id.split(':', 3).join(':'),
121
121
  ...props,
122
122
  });
@@ -127,7 +127,7 @@ class ManagerFlow extends ManagerFlowV3 {
127
127
  ...props
128
128
  }) {
129
129
  return this.__super__getFlowCardAutocomplete({
130
- id: id.split(':').reverse()[0],
130
+ id: id.split(':').slice(3).join(':'),
131
131
  uri: id.split(':', 3).join(':'),
132
132
  ...props,
133
133
  });
@@ -591,6 +591,11 @@ class HomeyAPIV3 extends HomeyAPI {
591
591
 
592
592
  await this.connect();
593
593
  await Util.timeout(new Promise((resolve, reject) => {
594
+ if (this.isConnected() !== true) {
595
+ reject(new Error('Not connected after connect.'));
596
+ return;
597
+ }
598
+
594
599
  this.__homeySocket.once('disconnect', (reason) => {
595
600
  reject(new Error(reason));
596
601
  });
@@ -625,6 +630,11 @@ class HomeyAPIV3 extends HomeyAPI {
625
630
  Promise.resolve().then(async () => {
626
631
  await this.connect();
627
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
+
628
638
  this.__homeySocket.once('disconnect', (reason) => {
629
639
  reject(new Error(reason));
630
640
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.4.13",
3
+ "version": "3.4.15",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [