Skip to content

Commit cdafcc9

Browse files
committed
Update to 2.2.1
1 parent fddf70a commit cdafcc9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG.md
22

3+
## 2.2.1
4+
* Fixed a bug where the previous entry was not properly read
5+
36
## 2.2.0
47
* Add support for fixing powercalc entities
58
* Fixing core.restore_state and powercalc_group is ignored if files do not exist

HA_FixNegativeStatistics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from datetime import datetime
1717

1818
__author__ = "Sebastian Hollas"
19-
__version__ = "2.2.0"
19+
__version__ = "2.2.1"
2020

2121
####################################################################################
2222
# USER INPUT REQUIRED !
@@ -198,7 +198,7 @@ def recalculateStatistics(metadata_id: int, key: str) -> str:
198198
continue
199199

200200
# Get previous entry
201-
_, pre_value = result[index]
201+
_, pre_value = result[index-1]
202202

203203
# Convert do decimal object
204204
value = Decimal(str(value))
@@ -273,7 +273,7 @@ def recalculateStates(metadata_id: int):
273273

274274
continue
275275

276-
pre_state_id, pre_state, _, _ = result[index]
276+
pre_state_id, pre_state, _, _ = result[index-1]
277277

278278
if old_state_id is None:
279279
# old_state_id is missing; Update to id of previous entry

0 commit comments

Comments
 (0)