Skip to content

Commit

Permalink
Updated get_active_power() algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Konstantinov committed Apr 7, 2023
1 parent 0873065 commit f810dbe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ async def asic_status():
return output


@app.get("/get_active_power", description="Returns power (in Watts) used by all ASICs. Currently we use evaluation based total hashrate")
@app.get("/get_active_power", description="Returns power (in Watts) used by all ASICs (calculated value)")
async def get_active_power():
return get_power_by_hashrate()
with orm.db_session:
hosts = Hosts.select()
power = 0

for host in hosts:
power += host.power if host.online.lower() == 'true' else 0

return power


@app.get("/get_asic_info/{asic_id}", include_in_schema=False, description="Returns an info about an ASIC from API")
Expand Down

0 comments on commit f810dbe

Please sign in to comment.