Skip to content

Commit

Permalink
fix: convert F to C is missing in some case #239
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin committed Jun 2, 2023
1 parent 3709f0e commit bb56a5b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/devices/AirConditioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,15 @@ export class ACStatus {
return temperatureInCelsius;
}

// lookup fahrenheit value by celsius value from table TempFahToCel
const temperatureInFahrenheit = parseInt(this.device.deviceModel.lookupMonitorName('TempFahToCel', temperatureInCelsius));
if (temperatureInFahrenheit === undefined) {
// lookup fahrenheit value by celsius value from table TempCelToFah
let temperatureInFahrenheit = parseInt(this.device.deviceModel.lookupMonitorValue('TempCelToFah', temperatureInCelsius));
if (isNaN(temperatureInFahrenheit)) {
// lookup again in table TempFahToCel
temperatureInFahrenheit = parseInt(this.device.deviceModel.lookupMonitorValue('TempFahToCel', temperatureInCelsius));
}

// if not found in both tables, return original value
if (isNaN(temperatureInFahrenheit)) {
return temperatureInCelsius;
}

Expand Down

0 comments on commit bb56a5b

Please sign in to comment.