From 9cd21bb5a009e984a5faaec411141b6dcab4749b Mon Sep 17 00:00:00 2001 From: ikatkov Date: Thu, 22 Oct 2020 19:33:12 -0700 Subject: [PATCH] AQICalculator is off by 1 (#1331) Co-authored-by: Igor Katkov --- esphome/components/hm3301/aqi_calculator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/hm3301/aqi_calculator.cpp b/esphome/components/hm3301/aqi_calculator.cpp index 6b70c5d4fd..3b9a9a11cc 100644 --- a/esphome/components/hm3301/aqi_calculator.cpp +++ b/esphome/components/hm3301/aqi_calculator.cpp @@ -33,7 +33,7 @@ class AQICalculator : public AbstractAQICalculator { } int get_grid_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2]) { - for (int i = 0; i < AMOUNT_OF_LEVELS - 1; i++) { + for (int i = 0; i < AMOUNT_OF_LEVELS; i++) { if (value >= array[i][0] && value <= array[i][1]) { return i; }