Skip to content

Commit

Permalink
Order temp before get the min and max for IRAirConditionerAccessory (#…
Browse files Browse the repository at this point in the history
…433)

* Order temp before get the min and max

* fix array name
  • Loading branch information
tuliocll authored Jan 12, 2024
1 parent 610d315 commit 4c2655a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/accessory/IRAirConditionerAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ export default class IRAirConditionerAccessory extends BaseAccessory {
return undefined;
}

const min = keyRangeItem.temp_list[0].temp;
const max = keyRangeItem.temp_list[keyRangeItem.temp_list.length - 1].temp;
const tempList = keyRangeItem.temp_list.map((temp) => temp.temp);

const min = Math.min(...tempList);
const max = Math.max(...tempList);
return [min, max];
}

Expand Down

0 comments on commit 4c2655a

Please sign in to comment.