Skip to content

Commit

Permalink
Round power consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 28, 2020
1 parent eaead01 commit ffd0d26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/sonoff/sonoff_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async def _process_ws_msg(self, data: dict):
if 'config' in data and 'hundredDaysKwhData' in data['config']:
# 000002 000207 000003 000002 000201 000008 000003 000006...
kwh = data['config']['hundredDaysKwhData']
kwh = [float(kwh[i + 1] + kwh[i + 3] + kwh[i + 5]) * 0.01
kwh = [round(int(kwh[i + 1] + kwh[i + 3] + kwh[i + 5]) * 0.01, 2)
for i in range(0, len(kwh), 6)]
data['params'] = {'consumption': kwh}

Expand Down

0 comments on commit ffd0d26

Please sign in to comment.