homey-api 1.10.13 → 1.10.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.
|
@@ -209,7 +209,7 @@ class Manager extends EventEmitter {
|
|
|
209
209
|
// try to get the CRUD Item from Cache.
|
|
210
210
|
if (this.isConnected() && operation.crud && $cache === true) {
|
|
211
211
|
const itemId = items[operation.crud.item].id;
|
|
212
|
-
const itemType = items[operation.crud.item].type;
|
|
212
|
+
const itemType = items[operation.crud.item].type || 'id';
|
|
213
213
|
|
|
214
214
|
switch (operation.crud.type) {
|
|
215
215
|
case 'getOne': {
|
|
@@ -291,7 +291,7 @@ class Manager extends EventEmitter {
|
|
|
291
291
|
// Transform and cache output if this is a CRUD call
|
|
292
292
|
if (operation.crud) {
|
|
293
293
|
const itemId = items[operation.crud.item].id;
|
|
294
|
-
const itemType = items[operation.crud.item].type;
|
|
294
|
+
const itemType = items[operation.crud.item].type || 'id';
|
|
295
295
|
const ItemClass = this.constructor.ITEMS[itemId] || Item;
|
|
296
296
|
const getItemKey = props => {
|
|
297
297
|
if (itemType === 'filter') return `${props.uri}:${props.id}`;
|
|
@@ -460,7 +460,7 @@ class Manager extends EventEmitter {
|
|
|
460
460
|
|| event.endsWith('.delete')) {
|
|
461
461
|
const [itemId, operation] = event.split('.');
|
|
462
462
|
const ItemClass = this.constructor.ITEMS[itemId] || Item;
|
|
463
|
-
const itemType = this.__itemsById[itemId].type;
|
|
463
|
+
const itemType = this.__itemsById[itemId].type || 'id';
|
|
464
464
|
const key = itemType === 'filter'
|
|
465
465
|
? `${data.uri}:${data.id}`
|
|
466
466
|
: `${data.id}`;
|
|
@@ -113,9 +113,13 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
113
113
|
* A manager instance is created when it's first accessed
|
|
114
114
|
*/
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
getSpecification() {
|
|
117
117
|
// eslint-disable-next-line global-require
|
|
118
|
-
|
|
118
|
+
return require('../../assets/specifications/HomeyAPIV2.json');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
generateManagersFromSpecification() {
|
|
122
|
+
const { managers } = this.getSpecification();
|
|
119
123
|
Object.entries(managers).forEach(([managerName, manager]) => {
|
|
120
124
|
this.generateManagerFromSpecification(managerName, manager);
|
|
121
125
|
});
|
|
@@ -11,6 +11,11 @@ const HomeyAPIV3 = require('./HomeyAPIV3');
|
|
|
11
11
|
*/
|
|
12
12
|
class HomeyAPIV3Local extends HomeyAPIV3 {
|
|
13
13
|
|
|
14
|
+
getSpecification() {
|
|
15
|
+
// eslint-disable-next-line global-require
|
|
16
|
+
return require('../../assets/specifications/HomeyAPIV3Local.json');
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
module.exports = HomeyAPIV3Local;
|