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 a349cc9 commit 0734838Copy full SHA for 0734838
plugwise/util.py
@@ -235,14 +235,8 @@ def power_data_energy_diff(
235
and "phase" not in measurement
236
and "interval" not in net_string
237
):
238
- diff = 1
239
- if "produced" in measurement:
240
- diff = -1
241
- if net_string not in data["sensors"]:
242
- tmp_val: float | int = 0
243
- else:
244
- tmp_val = data["sensors"][net_string]
245
-
+ diff = 1 if "produced" in measurement else -1
+ tmp_val: float | int = data["sensors"].get(net_string, 0)
246
if isinstance(f_val, int):
247
tmp_val += f_val * diff
248
else:
0 commit comments