We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0734838 commit 23cd423Copy full SHA for 23cd423
plugwise/util.py
@@ -236,12 +236,10 @@ def power_data_energy_diff(
236
and "interval" not in net_string
237
):
238
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}")
+ tmp_val = data["sensors"].get(net_string, 0)
+ tmp_val += f_val * diff
+ if isinstance(f_val, float):
+ tmp_val = f"{round(tmp_val, 3):.3f}"
245
246
data["sensors"][net_string] = tmp_val
247
0 commit comments