homey-api 3.13.1 → 3.13.3

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.
@@ -6163,6 +6163,15 @@
6163
6163
  "homey.geolocation.readonly"
6164
6164
  ],
6165
6165
  "parameters": {}
6166
+ },
6167
+ "getWeatherHourly": {
6168
+ "method": "get",
6169
+ "path": "/forecast/hourly",
6170
+ "private": false,
6171
+ "scopes": [
6172
+ "homey.geolocation.readonly"
6173
+ ],
6174
+ "parameters": {}
6166
6175
  }
6167
6176
  }
6168
6177
  },
@@ -4534,6 +4534,15 @@
4534
4534
  "homey.geolocation.readonly"
4535
4535
  ],
4536
4536
  "parameters": {}
4537
+ },
4538
+ "getWeatherHourly": {
4539
+ "method": "get",
4540
+ "path": "/forecast/hourly",
4541
+ "private": false,
4542
+ "scopes": [
4543
+ "homey.geolocation.readonly"
4544
+ ],
4545
+ "parameters": {}
4537
4546
  }
4538
4547
  }
4539
4548
  },
@@ -6187,6 +6187,15 @@
6187
6187
  "homey.geolocation.readonly"
6188
6188
  ],
6189
6189
  "parameters": {}
6190
+ },
6191
+ "getWeatherHourly": {
6192
+ "method": "get",
6193
+ "path": "/forecast/hourly",
6194
+ "private": false,
6195
+ "scopes": [
6196
+ "homey.geolocation.readonly"
6197
+ ],
6198
+ "parameters": {}
6190
6199
  }
6191
6200
  }
6192
6201
  },
@@ -2899,6 +2899,8 @@ export namespace HomeyAPIV3Cloud {
2899
2899
  getState(): Promise<any>;
2900
2900
 
2901
2901
  getWeather(): Promise<any>;
2902
+
2903
+ getWeatherHourly(): Promise<any>;
2902
2904
  }
2903
2905
 
2904
2906
  export class ManagerWebserver extends HomeyAPIV3.ManagerWebserver {
@@ -4627,6 +4629,8 @@ export namespace HomeyAPIV3Local {
4627
4629
  getState(): Promise<any>;
4628
4630
 
4629
4631
  getWeather(): Promise<any>;
4632
+
4633
+ getWeatherHourly(): Promise<any>;
4630
4634
  }
4631
4635
 
4632
4636
  export class ManagerWebserver extends HomeyAPIV3.ManagerWebserver {
@@ -9890,6 +9890,8 @@ export namespace HomeyAPIV3Cloud {
9890
9890
  getState(): Promise<any>;
9891
9891
 
9892
9892
  getWeather(): Promise<any>;
9893
+
9894
+ getWeatherHourly(): Promise<any>;
9893
9895
  }
9894
9896
 
9895
9897
  export class ManagerWebserver extends HomeyAPIV3.ManagerWebserver {
@@ -11904,6 +11906,8 @@ export namespace HomeyAPIV3Local {
11904
11906
  getState(): Promise<any>;
11905
11907
 
11906
11908
  getWeather(): Promise<any>;
11909
+
11910
+ getWeatherHourly(): Promise<any>;
11907
11911
  }
11908
11912
 
11909
11913
  export class ManagerWebserver extends HomeyAPIV3.ManagerWebserver {
@@ -20,18 +20,27 @@ class AdvancedFlow extends AdvancedFlowV3 {
20
20
  }
21
21
 
22
22
  static transformSet(item) {
23
- if (item.cards) {
24
- for (const card of Object.values(item.cards)) {
23
+ const nextItem = {
24
+ ...item,
25
+ };
26
+
27
+ if (nextItem.cards) {
28
+ nextItem.cards = { ...nextItem.cards };
29
+
30
+ for (const [key, card] of Object.entries(nextItem.cards)) {
25
31
  if (card.type !== 'trigger' && card.type !== 'condition' && card.type !== 'action') {
26
32
  continue;
27
33
  }
28
34
 
29
- card.ownerUri = card.id.split(':', 3).join(':');
30
- card.id = card.id.split(':').reverse()[0];
35
+ nextItem.cards[key] = {
36
+ ...card,
37
+ ownerUri: card.id.split(':', 3).join(':'),
38
+ id: card.id.split(':').reverse()[0],
39
+ };
31
40
  }
32
41
  }
33
42
 
34
- return item;
43
+ return nextItem;
35
44
  }
36
45
  }
37
46
 
@@ -3,7 +3,6 @@
3
3
  const FlowV3 = require('../../HomeyAPIV3/ManagerFlow/Flow');
4
4
 
5
5
  class Flow extends FlowV3 {
6
-
7
6
  static transformGet(item) {
8
7
  item = super.transformGet(item);
9
8
 
@@ -13,14 +12,14 @@ class Flow extends FlowV3 {
13
12
  }
14
13
 
15
14
  if (Array.isArray(item.conditions)) {
16
- item.conditions.forEach(card => {
15
+ item.conditions.forEach((card) => {
17
16
  card.id = `${card.uri}:${card.id}`;
18
17
  delete card.uri;
19
18
  });
20
19
  }
21
20
 
22
21
  if (Array.isArray(item.actions)) {
23
- item.actions.forEach(card => {
22
+ item.actions.forEach((card) => {
24
23
  card.id = `${card.uri}:${card.id}`;
25
24
  delete card.uri;
26
25
  });
@@ -32,28 +31,36 @@ class Flow extends FlowV3 {
32
31
  }
33
32
 
34
33
  static transformSet(item) {
35
- if (item.trigger) {
36
- item.trigger.uri = item.trigger.id.split(':', 3).join(':');
37
- item.trigger.id = item.trigger.id.split(':').slice(3).join(':');
34
+ const nextItem = {
35
+ ...item,
36
+ };
37
+
38
+ if (nextItem.trigger) {
39
+ nextItem.trigger = {
40
+ ...nextItem.trigger,
41
+ uri: nextItem.trigger.id.split(':', 3).join(':'),
42
+ id: nextItem.trigger.id.split(':').slice(3).join(':'),
43
+ };
38
44
  }
39
45
 
40
- if (Array.isArray(item.conditions)) {
41
- item.conditions.forEach(card => {
42
- card.uri = card.id.split(':', 3).join(':');
43
- card.id = card.id.split(':').slice(3).join(':');
44
- });
46
+ if (Array.isArray(nextItem.conditions)) {
47
+ nextItem.conditions = nextItem.conditions.map((card) => ({
48
+ ...card,
49
+ uri: card.id.split(':', 3).join(':'),
50
+ id: card.id.split(':').slice(3).join(':'),
51
+ }));
45
52
  }
46
53
 
47
- if (Array.isArray(item.actions)) {
48
- item.actions.forEach(card => {
49
- card.uri = card.id.split(':', 3).join(':');
50
- card.id = card.id.split(':').slice(3).join(':');
51
- });
54
+ if (Array.isArray(nextItem.actions)) {
55
+ nextItem.actions = nextItem.actions.map((card) => ({
56
+ ...card,
57
+ uri: card.id.split(':', 3).join(':'),
58
+ id: card.id.split(':').slice(3).join(':'),
59
+ }));
52
60
  }
53
61
 
54
- return item;
62
+ return nextItem;
55
63
  }
56
-
57
64
  }
58
65
 
59
66
  module.exports = Flow;
@@ -48,7 +48,7 @@ class Item extends EventEmitter {
48
48
  enumerable: false,
49
49
  writable: false,
50
50
  });
51
-
51
+
52
52
  Object.defineProperty(this, '__connected', {
53
53
  value: false,
54
54
  enumerable: false,
@@ -106,8 +106,8 @@ class Item extends EventEmitter {
106
106
  }
107
107
 
108
108
  __delete() {
109
- this.destroy();
110
109
  this.emit('delete');
110
+ this.destroy();
111
111
  }
112
112
 
113
113
  /**
@@ -183,7 +183,9 @@ class Item extends EventEmitter {
183
183
  this.__connected = false;
184
184
 
185
185
  if (this.io) {
186
- this.io.then(io => io.unsubscribe()).catch(err => this.__debug('Error Disconnecting:', err));
186
+ this.io
187
+ .then((io) => io.unsubscribe())
188
+ .catch((err) => this.__debug('Error Disconnecting:', err));
187
189
  }
188
190
  });
189
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.13.1",
3
+ "version": "3.13.3",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [