2424from pyasic .data import Fan , HashBoard
2525from pyasic .data .error_codes import MinerErrorData , WhatsminerError
2626from pyasic .data .pools import PoolMetrics , PoolUrl
27+ from pyasic .device import MinerAlgo
2728from pyasic .device .algorithm import AlgoHashRateType
2829from pyasic .errors import APIError
2930from pyasic .miners .data import DataFunction , DataLocations , DataOptions , RPCAPICommand
@@ -1163,7 +1164,11 @@ async def _get_hashboards(
11631164 board_count = (
11641165 rpc_get_device_info .get ("msg" , {}).get ("hardware" , {}).get ("boards" , 3 )
11651166 )
1166- edevs = rpc_get_miner_status_edevs .get ("msg" , {}).get ("edevs" , [])
1167+ edevs_base = rpc_get_miner_status_edevs .get ("msg" , {})
1168+ if isinstance (edevs_base , dict ):
1169+ edevs = edevs_base .get ("edevs" , [])
1170+ else :
1171+ edevs = []
11671172 for idx in range (board_count ):
11681173 board_data = edevs [idx ] if idx < len (edevs ) else {}
11691174 boards .append (
@@ -1262,12 +1267,19 @@ async def _get_hashrate(
12621267 if rpc_get_miner_status_summary is None :
12631268 return None
12641269
1265- return (
1270+ res = (
12661271 rpc_get_miner_status_summary .get ("msg" , {})
12671272 .get ("summary" , {})
12681273 .get ("hash-realtime" )
12691274 )
12701275
1276+ if res is not None :
1277+ return self .algo .hashrate (
1278+ rate = float (res ),
1279+ unit = self .algo .unit .TH , # type: ignore[attr-defined]
1280+ ).into (self .algo .unit .default ) # type: ignore[attr-defined]
1281+ return None
1282+
12711283 async def _get_expected_hashrate (
12721284 self , rpc_get_miner_status_summary : dict | None = None
12731285 ) -> AlgoHashRateType | None :
@@ -1288,7 +1300,13 @@ async def _get_expected_hashrate(
12881300 - 0.001 * self .expected_hashboards
12891301 ):
12901302 return None
1291- return res
1303+
1304+ if res is not None :
1305+ return self .algo .hashrate (
1306+ rate = float (res ),
1307+ unit = self .algo .unit .TH , # type: ignore[attr-defined]
1308+ ).into (self .algo .unit .default ) # type: ignore[attr-defined]
1309+ return None
12921310
12931311 async def _get_env_temp (
12941312 self , rpc_get_miner_status_summary : dict | None = None
0 commit comments