Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Improve guard for missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjbradshaw committed Feb 17, 2023
1 parent 89131f6 commit 33efa8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,13 @@ class AEGWellbeingPlatform implements DynamicPlatformPlugin {
const state = this.getApplianceState(pncId, data);

// Guard against missing data due to API request failure.
if (!state) {
if (!state || !state.name) {
this.log.warn(`No appliance data returned by API for ${pncId}`);
return;
}

// this.log.debug(JSON.stringify(state));

// Keep firmware revision up-to-date in case the device is updated.
accessory
.getService(Service.AccessoryInformation)!
Expand Down

0 comments on commit 33efa8a

Please sign in to comment.