Skip to content

Commit

Permalink
Update miner data sourcing to match latest pyasic version.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rowan authored May 26, 2024
1 parent 9c51dc8 commit 59e85bb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions custom_components/miner/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ async def _async_update_data(self):

_LOGGER.debug(f"Got data: {miner_data}")

try:
hashrate = round(float(miner_data.hashrate), 2)
except TypeError:
hashrate = None

try:
expected_hashrate = round(float(miner_data.expected_hashrate), 2)
except TypeError:
expected_hashrate = None

data = {
"hostname": miner_data.hostname,
"mac": miner_data.mac,
Expand All @@ -105,8 +115,8 @@ async def _async_update_data(self):
"is_mining": miner_data.is_mining,
"fw_ver": miner_data.fw_ver,
"miner_sensors": {
"hashrate": miner_data.hashrate,
"ideal_hashrate": miner_data.expected_hashrate,
"hashrate": hashrate,
"ideal_hashrate": expected_hashrate,
"temperature": miner_data.temperature_avg,
"power_limit": miner_data.wattage_limit,
"miner_consumption": miner_data.wattage,
Expand Down

0 comments on commit 59e85bb

Please sign in to comment.