Added check for empty accessories list
This commit is contained in:
parent
c8d117a894
commit
d07d621e45
@ -75,7 +75,8 @@ export class SmartHomeNGPlatform implements StaticPlatformPlugin {
|
|||||||
|
|
||||||
// convert all configured accessory keys to lowercase to tolerate user case errors
|
// convert all configured accessory keys to lowercase to tolerate user case errors
|
||||||
const accessories = JSON.parse(JSON.stringify(uncapitalizeKeys(this.config.accessories)));
|
const accessories = JSON.parse(JSON.stringify(uncapitalizeKeys(this.config.accessories)));
|
||||||
|
this.log.debug(accessories);
|
||||||
|
if (Object.keys(accessories).length > 0) {
|
||||||
for (const accessory of accessories) {
|
for (const accessory of accessories) {
|
||||||
if (!accessory.manufacturer) {
|
if (!accessory.manufacturer) {
|
||||||
accessory.manufacturer = 'SmartHomeNG';
|
accessory.manufacturer = 'SmartHomeNG';
|
||||||
@ -167,6 +168,8 @@ export class SmartHomeNGPlatform implements StaticPlatformPlugin {
|
|||||||
this.log.warn('Ignoring accessory (no type given): ' + accessory);
|
this.log.warn('Ignoring accessory (no type given): ' + accessory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
callback(devices);
|
callback(devices);
|
||||||
this.log.debug('Finished building accessories list');
|
this.log.debug('Finished building accessories list');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user