Skip to content

Commit 23cd423

Browse files
committed
Improve further
1 parent 0734838 commit 23cd423

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plugwise/util.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,10 @@ def power_data_energy_diff(
236236
and "interval" not in net_string
237237
):
238238
diff = 1 if "produced" in measurement else -1
239-
tmp_val: float | int = data["sensors"].get(net_string, 0)
240-
if isinstance(f_val, int):
241-
tmp_val += f_val * diff
242-
else:
243-
tmp_val += float(f_val * diff)
244-
tmp_val = float(f"{round(tmp_val, 3):.3f}")
239+
tmp_val = data["sensors"].get(net_string, 0)
240+
tmp_val += f_val * diff
241+
if isinstance(f_val, float):
242+
tmp_val = f"{round(tmp_val, 3):.3f}"
245243

246244
data["sensors"][net_string] = tmp_val
247245

0 commit comments

Comments
 (0)