@@ -855,6 +855,10 @@ async def upgrade_firmware(
855855 str (DataOptions .FAN_PSU ): DataFunction (
856856 "_get_psu_fans" , [RPCAPICommand ("rpc_get_device_info" , "get.device.info" )]
857857 ),
858+ str (DataOptions .ERRORS ): DataFunction (
859+ "_get_errors" ,
860+ [RPCAPICommand ("rpc_get_device_info" , "get.device.info" )],
861+ ),
858862 str (DataOptions .HASHBOARDS ): DataFunction (
859863 "_get_hashboards" ,
860864 [
@@ -1130,6 +1134,40 @@ async def _get_psu_fans(self, rpc_get_device_info: dict | None = None) -> list[F
11301134 rpm = rpc_get_device_info .get ("msg" , {}).get ("power" , {}).get ("fanspeed" )
11311135 return [Fan (speed = rpm )] if rpm is not None else []
11321136
1137+ async def _get_errors (
1138+ self , rpc_get_device_info : dict | None = None
1139+ ) -> list [MinerErrorData ]:
1140+ if rpc_get_device_info is None :
1141+ try :
1142+ rpc_get_device_info = await self .rpc .get_device_info ()
1143+ except APIError :
1144+ return []
1145+
1146+ if rpc_get_device_info is None :
1147+ return []
1148+
1149+ raw_errors = rpc_get_device_info .get ("msg" , {}).get ("error-code" , [])
1150+ if not isinstance (raw_errors , list ):
1151+ return []
1152+
1153+ parsed_codes : list [int ] = []
1154+ for item in raw_errors :
1155+ if isinstance (item , dict ):
1156+ for key in item .keys ():
1157+ if str (key ).lower () == "reason" :
1158+ continue
1159+ try :
1160+ parsed_codes .append (int (key ))
1161+ except (TypeError , ValueError ):
1162+ continue
1163+ else :
1164+ try :
1165+ parsed_codes .append (int (item ))
1166+ except (TypeError , ValueError ):
1167+ continue
1168+
1169+ return [WhatsminerError (error_code = code ) for code in sorted (set (parsed_codes ))]
1170+
11331171 async def _get_serial_number (
11341172 self , rpc_get_device_info : dict | None = None
11351173 ) -> str | None :
0 commit comments