Skip to content

Commit

Permalink
Tweak the validation per @bwp91: avoid Homebridge crash loop when the…
Browse files Browse the repository at this point in the history
… plugin is misconfigured. See homebridge/plugins#527 (comment).
  • Loading branch information
wimleers committed Jun 14, 2023
1 parent 5a3bd37 commit 8022bfe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function SMAHomeManager(log, config, api) {
// Validate configuration, since `homebridge-config-ui-x` is optional.
['signals', 'surplusSignals'].forEach(requiredTopLevelKey => {
if (!Object.keys(config).includes(requiredTopLevelKey)) {
throw new Error(`Invalid configuration: ${requiredTopLevelKey} key is missing. See config.schema.json.`);
log.warning(`Invalid configuration: ${requiredTopLevelKey} key is missing. See config.schema.json.`);
return;
}
});

Expand Down

0 comments on commit 8022bfe

Please sign in to comment.