Skip to content

Commit a0f2a66

Browse files
rozieVilppu Vuorinen
authored andcommitted
1 parent f90e733 commit a0f2a66

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pymelcloud/device.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ def daily_energy_consumed(self) -> Optional[float]:
218218
consumption = 0
219219

220220
for mode in ['Heating', 'Cooling', 'Auto', 'Dry', 'Fan', 'Other']:
221-
consumption += self._energy_report.get(mode, [0.0])[-1]
221+
previous_reports = self._energy_report.get(mode, [0.0])
222+
if previous_reports:
223+
last_report = previous_reports[-1]
224+
else:
225+
last_report = 0.0
226+
consumption += last_report
222227

223228
return consumption
224229

0 commit comments

Comments
 (0)