Skip to content

Commit

Permalink
fix: fridge water filter
Browse files Browse the repository at this point in the history
  • Loading branch information
nVuln committed Jul 24, 2024
1 parent 0e37ade commit 0af4d45
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/devices/Refrigerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,19 @@ export class RefrigeratorStatus {
}

public get waterFilterRemain() {
if ('waterFilter1RemainP' in this.data) {
return this.data?.waterFilter1RemainP || 0;
}

if ('waterFilter' in this.data) {
const usedInMonth = parseInt(this.data?.waterFilter.match(/(\d)_/)[1]);
if (isNaN(usedInMonth)) {
return 0;
}

return (12 - usedInMonth) / 12 * 100;
}

return this.data?.waterFilter1RemainP || 0;
}

Expand Down

0 comments on commit 0af4d45

Please sign in to comment.