From 7b157aeff1dafa532fdcabe1f9daac8a918c3a9d 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 ac573fbad6..41e538a399 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; }