From 4f764fab945560f697725e153b01ce40e8477718 Mon Sep 17 00:00:00 2001 From: Vadim Grinco Date: Tue, 19 Oct 2021 12:32:28 +0200 Subject: [PATCH] Fixed the bug introduced in v0.1.1 Starting history attribute counter from 0 (to match date.hour); This will remove the 1 hour offset - bug intorduced in previous release Signed-off-by: Vadim Grinco --- sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensor.py b/sensor.py index 915f5c8..f31b1d1 100644 --- a/sensor.py +++ b/sensor.py @@ -89,7 +89,7 @@ def _get_current_value(self): for values in json['data']['dataLine']: if values['title'] == cost_string: for data in values['point']: - history_index = int(data[hour_axis]) + history_index = int(data[hour_axis])-1 cost_history[history_index] = float(data[cost_axis]) current_cost = cost_history[date.hour]