diff --git a/pyasic/miners/_types/whatsminer/M2X/M20S.py b/pyasic/miners/_types/whatsminer/M2X/M20S.py index b8aa23f2..9d48fd55 100644 --- a/pyasic/miners/_types/whatsminer/M2X/M20S.py +++ b/pyasic/miners/_types/whatsminer/M2X/M20S.py @@ -8,3 +8,21 @@ def __init__(self, ip: str): self.model = "M20S" self.nominal_chips = 66 self.fan_count = 2 + + +class M20SV10(BaseMiner): + def __init__(self, ip: str): + super().__init__() + self.ip = ip + self.model = "M20S" + self.nominal_chips = 105 + self.fan_count = 2 + + +class M20SV20(BaseMiner): + def __init__(self, ip: str): + super().__init__() + self.ip = ip + self.model = "M20S" + self.nominal_chips = 111 + self.fan_count = 2 diff --git a/pyasic/miners/_types/whatsminer/M2X/__init__.py b/pyasic/miners/_types/whatsminer/M2X/__init__.py index 093ff139..9b56cd2c 100644 --- a/pyasic/miners/_types/whatsminer/M2X/__init__.py +++ b/pyasic/miners/_types/whatsminer/M2X/__init__.py @@ -1,4 +1,4 @@ -from .M20S import M20S +from .M20S import M20S, M20SV10, M20SV20 from .M20S_Plus import M20SPlus from .M21 import M21 diff --git a/pyasic/miners/miner_factory.py b/pyasic/miners/miner_factory.py index ba0da42b..268ae2ce 100644 --- a/pyasic/miners/miner_factory.py +++ b/pyasic/miners/miner_factory.py @@ -123,6 +123,8 @@ "M20S": { "Default": BTMinerM20S, "BTMiner": BTMinerM20S, + "10": BTMinerM20SV10, + "20": BTMinerM20SV20, }, "M20S+": { "Default": BTMinerM20SPlus, @@ -452,24 +454,24 @@ async def _get_miner_type( if "BOSminer+" in version["VERSION"][0].keys(): api = "BOSMiner+" + # check for avalonminers + if version["VERSION"][0].get("PROD"): + _data = version["VERSION"][0]["PROD"].split("-") + model = _data[0] + if len(data) > 1: + ver = _data[1] + elif version["VERSION"][0].get("MODEL"): + _data = version["VERSION"][0]["MODEL"].split("-") + model = f"AvalonMiner {_data[0]}" + if len(data) > 1: + ver = _data[1] + # if all that fails, check the Description to see if it is a whatsminer if version.get("Description") and ( "whatsminer" in version.get("Description") ): api = "BTMiner" - # check for avalonminers - if version["VERSION"][0].get("PROD"): - _data = version["VERSION"][0]["PROD"].split("-") - model = _data[0] - if len(data) > 1: - ver = _data[1] - elif version["VERSION"][0].get("MODEL"): - _data = version["VERSION"][0]["MODEL"].split("-") - model = f"AvalonMiner {_data[0]}" - if len(data) > 1: - ver = _data[1] - # if we have no model from devdetails but have version, try to get it from there if version and not model: # make sure version isn't blank diff --git a/pyasic/miners/whatsminer/btminer/M2X/M20S.py b/pyasic/miners/whatsminer/btminer/M2X/M20S.py index b2a91bf8..b3629479 100644 --- a/pyasic/miners/whatsminer/btminer/M2X/M20S.py +++ b/pyasic/miners/whatsminer/btminer/M2X/M20S.py @@ -1,8 +1,24 @@ from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module -from pyasic.miners._types import M20S # noqa - Ignore access to _module +from pyasic.miners._types import ( # noqa - Ignore access to _module + M20S, + M20SV10, + M20SV20, +) class BTMinerM20S(BTMiner, M20S): def __init__(self, ip: str) -> None: super().__init__(ip) self.ip = ip + + +class BTMinerM20SV10(BTMiner, M20SV10): + def __init__(self, ip: str) -> None: + super().__init__(ip) + self.ip = ip + + +class BTMinerM20SV20(BTMiner, M20SV20): + def __init__(self, ip: str) -> None: + super().__init__(ip) + self.ip = ip diff --git a/pyasic/miners/whatsminer/btminer/M2X/__init__.py b/pyasic/miners/whatsminer/btminer/M2X/__init__.py index 2cafe6ea..51313247 100644 --- a/pyasic/miners/whatsminer/btminer/M2X/__init__.py +++ b/pyasic/miners/whatsminer/btminer/M2X/__init__.py @@ -1,4 +1,4 @@ -from .M20S import BTMinerM20S +from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20 from .M20S_Plus import BTMinerM20SPlus from .M21 import BTMinerM21 diff --git a/pyasic/network/net_range.py b/pyasic/network/net_range.py index 2151734f..e0ab5b43 100644 --- a/pyasic/network/net_range.py +++ b/pyasic/network/net_range.py @@ -8,9 +8,9 @@ class MinerNetworkRange: Parameters: ip_range: ## A range of IP addresses to put in the network, or a list of IPs * Takes a string formatted as: - * {ip_range_1_start}-{ip_range_1_end}, {ip_address_1}, {ip_range_2_start}-{ip_range_2_end}, {ip_address_2}... - * Also takes a list of strings formatted as: - * [{ip_address_1}, {ip_address_2}, {ip_address_3}, ...] + ```f"{ip_range_1_start}-{ip_range_1_end}, {ip_address_1}, {ip_range_2_start}-{ip_range_2_end}, {ip_address_2}..."``` + * Also takes a list of strings or `ipaddress.ipaddress` formatted as: + ```[{ip_address_1}, {ip_address_2}, {ip_address_3}, ...]``` """ def __init__(self, ip_range: Union[str, list]):