pyasic

X9 Models

E9Pro

Bases: AntminerModern, E9Pro

Source code in pyasic/miners/antminer/bmminer/X9/E9.py
class BMMinerE9Pro(AntminerModern, E9Pro):
    def __init__(self, ip: str, api_ver: str = "0.0.0"):
        super().__init__(ip, api_ver)
        self.supports_shutdown = False

S9

Bases: BMMiner, S9

Source code in pyasic/miners/antminer/bmminer/X9/S9.py
class BMMinerS9(BMMiner, S9):
    pass

S9i

Bases: BMMiner, S9i

Source code in pyasic/miners/antminer/bmminer/X9/S9.py
class BMMinerS9i(BMMiner, S9i):
    pass

S9j

Bases: BMMiner, S9j

Source code in pyasic/miners/antminer/bmminer/X9/S9.py
class BMMinerS9j(BMMiner, S9j):
    pass

T9

Bases: BMMiner, T9

Source code in pyasic/miners/antminer/bmminer/X9/T9.py
class BMMinerT9(BMMiner, T9):
    pass

S9 (BOS)

Bases: BOSMiner, S9

Source code in pyasic/miners/antminer/bosminer/X9/S9.py
class BOSMinerS9(BOSMiner, S9):
    pass

T9 (Hiveon)

Bases: Hiveon, T9

Source code in pyasic/miners/antminer/hiveon/X9/T9.py
class HiveonT9(Hiveon, T9):
    def __init__(self, ip: str, api_ver: str = "0.0.0") -> None:
        super().__init__(ip, api_ver=api_ver)
        self.ip = ip
        self.pwd = "admin"

    ##################################################
    ### DATA GATHERING FUNCTIONS (get_{some_data}) ###
    ##################################################

    async def get_mac(self):
        try:
            mac = (
                (await self.send_ssh_command("cat /sys/class/net/eth0/address"))
                .strip()
                .upper()
            )
            return mac
        except (TypeError, ValueError, asyncssh.Error, OSError, AttributeError):
            pass

    async def get_hashboards(self, api_stats: dict = None) -> List[HashBoard]:
        board_map = {
            0: [2, 9, 10],
            1: [3, 11, 12],
            2: [4, 13, 14],
        }
        hashboards = []

        for board in board_map:
            hashboard = HashBoard(slot=board, expected_chips=self.nominal_chips)
            hashrate = 0
            chips = 0
            for chipset in board_map[board]:
                if hashboard.chip_temp == None:
                    try:
                        hashboard.board_temp = api_stats["STATS"][1][f"temp{chipset}"]
                        hashboard.chip_temp = api_stats["STATS"][1][f"temp2_{chipset}"]
                    except (KeyError, IndexError):
                        pass
                    else:
                        hashboard.missing = False
                try:
                    hashrate += api_stats["STATS"][1][f"chain_rate{chipset}"]
                    chips += api_stats["STATS"][1][f"chain_acn{chipset}"]
                except (KeyError, IndexError):
                    pass
            hashboard.hashrate = round(hashrate / 1000, 2)
            hashboard.chips = chips
            hashboards.append(hashboard)

        return hashboards

    async def get_wattage(self, api_stats: dict = None) -> Optional[int]:
        if not api_stats:
            try:
                api_stats = await self.api.stats()
            except APIError:
                pass

        if api_stats:
            boards = api_stats.get("STATS")
            try:
                wattage_raw = boards[1]["chain_power"]
            except (KeyError, IndexError):
                pass
            else:
                # parse wattage position out of raw data
                return round(float(wattage_raw.split(" ")[0]))

    async def get_env_temp(self, api_stats: dict = None) -> Optional[float]:
        env_temp_list = []
        board_map = {
            0: [2, 9, 10],
            1: [3, 11, 12],
            2: [4, 13, 14],
        }
        if not api_stats:
            try:
                api_stats = await self.api.stats()
            except APIError:
                pass
        if api_stats:
            for board in board_map.values():
                for chipset in board:
                    try:
                        env_temp = api_stats["STATS"][1][f"temp3_{chipset}"]
                        if not env_temp == 0:
                            env_temp_list.append(int(env_temp))
                    except (KeyError, IndexError):
                        pass

            if not env_temp_list == []:
                return round(float(sum(env_temp_list) / len(env_temp_list)), 2)

S9 (LuxOS)

Bases: LUXMiner, S9

Source code in pyasic/miners/antminer/luxos/X9/S9.py
class LUXMinerS9(LUXMiner, S9):
    pass