@@ -106,6 +106,10 @@ def get_new(v: str | None):
106106 "_get_wattage_limit" ,
107107 [RPCAPICommand ("rpc_summary" , "summary" )],
108108 ),
109+ str (DataOptions .SERIAL_NUMBER ): DataFunction (
110+ "_get_serial_number" ,
111+ [RPCAPICommand ("rpc_get_miner_info" , "get_miner_info" )],
112+ ),
109113 str (DataOptions .FANS ): DataFunction (
110114 "_get_fans" ,
111115 [
@@ -624,6 +628,22 @@ async def _get_errors(
624628 pass
625629 return errors # type: ignore[return-value]
626630
631+ async def _get_serial_number (
632+ self , rpc_get_miner_info : dict = None
633+ ) -> Optional [str ]:
634+ if rpc_get_miner_info is None :
635+ try :
636+ rpc_get_miner_info = await self .rpc .get_miner_info ()
637+ except APIError :
638+ pass
639+
640+ if rpc_get_miner_info is not None :
641+ try :
642+ return rpc_summary ["Msg" ]["minersn" ]
643+ except LookupError :
644+ pass
645+ return None
646+
627647 async def _get_expected_hashrate (
628648 self , rpc_summary : dict | None = None
629649 ) -> AlgoHashRateType | None :
@@ -852,6 +872,10 @@ async def upgrade_firmware(
852872 "_get_pools" ,
853873 [RPCAPICommand ("rpc_get_miner_status_summary" , "get.miner.status:summary" )],
854874 ),
875+ str (DataOptions .SERIAL_NUMBER ): DataFunction (
876+ "_get_serial_number" ,
877+ [RPCAPICommand ("rpc_get_device_info" , "get.device.info" )],
878+ ),
855879 str (DataOptions .UPTIME ): DataFunction (
856880 "_get_uptime" ,
857881 [RPCAPICommand ("rpc_get_miner_status_summary" , "get.miner.status:summary" )],
@@ -1100,6 +1124,22 @@ async def _get_psu_fans(self, rpc_get_device_info: dict | None = None) -> list[F
11001124 rpm = rpc_get_device_info .get ("msg" , {}).get ("power" , {}).get ("fanspeed" )
11011125 return [Fan (speed = rpm )] if rpm is not None else []
11021126
1127+ async def _get_serial_number (
1128+ self , rpc_get_device_info : dict = None
1129+ ) -> Optional [str ]:
1130+ if rpc_get_device_info is None :
1131+ try :
1132+ rpc_get_device_info = await self .rpc .get_device_info ()
1133+ except APIError :
1134+ pass
1135+
1136+ if rpc_get_device_info is not None :
1137+ try :
1138+ return rpc_get_device_info ["msg" ]["miner" ]["miner-sn" ]
1139+ except LookupError :
1140+ pass
1141+ return None
1142+
11031143 async def _get_hashboards (
11041144 self ,
11051145 rpc_get_device_info : dict | None = None ,
0 commit comments