Skip to content

Commit

Permalink
fix(air purifier): fix voc density exceeded maximum of 1000 warning (#51
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tomekkleszcz authored Mar 11, 2024
1 parent b44005e commit bbdd9ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/accessories/devices/airPurifier/pureA9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ export class PureA9 extends AirPurifier {
this._platform.config.vocMolecularWeight ?? 30.026
);

return vocDensity;
return Math.min(
vocDensity,
this.airQualityService.getCharacteristic(
this.platform.Characteristic.VOCDensity
).props.maxValue!
);
}

async getCurrentRelativeHumidity(): Promise<CharacteristicValue> {
Expand Down Expand Up @@ -207,7 +212,7 @@ export class PureA9 extends AirPurifier {
);
this.airQualityService.updateCharacteristic(
this.platform.Characteristic.VOCDensity,
this.appliance.properties.reported.TVOC
await this.getVOCDensity()
);

this.humiditySensorService.updateCharacteristic(
Expand Down
9 changes: 7 additions & 2 deletions src/accessories/devices/airPurifier/wellA7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ export class WellA7 extends AirPurifier {
this._platform.config.vocMolecularWeight ?? 30.026
);

return vocDensity;
return Math.min(
vocDensity,
this.airQualityService.getCharacteristic(
this.platform.Characteristic.VOCDensity
).props.maxValue!
);
}

async getCurrentRelativeHumidity(): Promise<CharacteristicValue> {
Expand Down Expand Up @@ -207,7 +212,7 @@ export class WellA7 extends AirPurifier {
);
this.airQualityService.updateCharacteristic(
this.platform.Characteristic.VOCDensity,
this.appliance.properties.reported.TVOC
await this.getVOCDensity()
);

this.humiditySensorService.updateCharacteristic(
Expand Down

0 comments on commit bbdd9ab

Please sign in to comment.