Skip to content

Commit

Permalink
fix: log unsupported products
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreif committed Dec 27, 2021
1 parent 0f29b3d commit 1d093cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ export class HatchBabyApi {
}

async getDevices() {
const [devices, onIotClient] = await Promise.all([
const [devices, onIotClient, member] = await Promise.all([
this.getIotDevices(),
this.getOnIotClient(),
this.getMember(),
]),
createDevice = <T extends IotDevice<any>>(
product: string,
Expand All @@ -160,6 +161,12 @@ export class HatchBabyApi {
.map((info) => new Device(info, onIotClient))
}

for (const product of member.products) {
if (!knownProducts.includes(product)) {
logInfo('Unsupported Product Found: ' + product)
}
}

return {
restPluses: createDevice('restPlus', RestPlus),
restMinis: createDevice('restMini', RestMini),
Expand Down

0 comments on commit 1d093cb

Please sign in to comment.