Browse Source

优化设备上报电量统计接口

zhangdongming 2 years ago
parent
commit
fc2d24ec6e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Controller/SensorGateway/SmartSocketController.py

+ 2 - 2
Controller/SensorGateway/SmartSocketController.py

@@ -125,7 +125,7 @@ class SmartSocketView(View):
             serial_number = request_dict.get('serialNumber', None)
             watt = request_dict.get('electricity', 0.00)  # 功率
             power = request_dict.get('power', 0.00)  # 负载功率
-            # 在线时长分钟
+            # 在线时长
             accumulated_time = request_dict.get('accumulatedTime', None)
             device_time = request_dict.get('deviceTime', None)
             LOGGER.info('{}上报电量统计data:{}'.format(serial_number, request_dict))
@@ -179,7 +179,7 @@ class SmartSocketView(View):
         """
         if watt == 0 or watt < 0.1 or minute == 0:
             return 0.00
-        hours = minute / 60
+        hours = minute / 3600
         kilowatt_hour = watt * hours / 1000
         LOGGER.info('瓦计算得到千瓦时结果{}'.format(kilowatt_hour))
         return kilowatt_hour