Compare commits

...

4 Commits

Author SHA1 Message Date
upstreamdata
0b8c08016b bump version number. 2022-07-27 23:48:42 -06:00
upstreamdata
8c768d351b fix a bug with braiinsOS+ miners which return with a capital letter in their model instead of a lowercase letter. 2022-07-27 23:44:19 -06:00
UpstreamData
c9e7fa2629 bump version number 2022-07-22 13:05:13 -06:00
UpstreamData
9d3f2b5968 add support for M20 versions and update docs 2022-07-22 13:04:47 -06:00
9 changed files with 117 additions and 28 deletions

View File

@@ -27,6 +27,8 @@ Supported miner types are here on this list. If your miner (or miner version) i
* [VE20][pyasic.miners.whatsminer.btminer.M3X.M31S_Plus.BTMinerM31SPlusVE20]
* [M32S][pyasic.miners.whatsminer.btminer.M3X.M32S.BTMinerM32S]
* M2X Series:
* [M20][pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20]:
* [V10][pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20V10]
* [M20S][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20S]:
* [V10][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20SV10]
* [V20][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20SV20]

View File

@@ -1,6 +1,22 @@
# pyasic
## M2X Models
## M20
::: pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20
handler: python
options:
show_root_heading: false
heading_level: 4
## M20V10
::: pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20V10
handler: python
options:
show_root_heading: false
heading_level: 4
## M20S
::: pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20S

View File

@@ -0,0 +1,33 @@
# Copyright 2022 Upstream Data Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pyasic.miners import BaseMiner
class M20(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20"
self.nominal_chips = 70
self.fan_count = 2
class M20V10(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20 V10"
self.nominal_chips = 70
self.fan_count = 2

View File

@@ -28,7 +28,7 @@ class M20SV10(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20S"
self.model = "M20S V10"
self.nominal_chips = 105
self.fan_count = 2
@@ -37,6 +37,6 @@ class M20SV20(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20S"
self.model = "M20S V20"
self.nominal_chips = 111
self.fan_count = 2

View File

@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .M20 import M20, M20V10
from .M20S import M20S, M20SV10, M20SV20
from .M20S_Plus import M20SPlus

View File

@@ -45,93 +45,98 @@ import asyncssh
AnyMiner = TypeVar("AnyMiner", bound=BaseMiner)
MINER_CLASSES = {
"Antminer S9": {
"ANTMINER S9": {
"Default": BOSMinerS9,
"BOSMiner": BOSMinerOld,
"BOSMiner+": BOSMinerS9,
"BMMiner": BMMinerS9,
"CGMiner": CGMinerS9,
},
"Antminer S9i": {
"ANTMINER S9I": {
"Default": BMMinerS9i,
"BMMiner": BMMinerS9i,
},
"Antminer S17": {
"ANTMINER S17": {
"Default": BMMinerS17,
"BOSMiner+": BOSMinerS17,
"BMMiner": BMMinerS17,
"CGMiner": CGMinerS17,
},
"Antminer S17+": {
"ANTMINER S17+": {
"Default": BMMinerS17Plus,
"BOSMiner+": BOSMinerS17Plus,
"BMMiner": BMMinerS17Plus,
"CGMiner": CGMinerS17Plus,
},
"Antminer S17 Pro": {
"ANTMINER S17 Pro": {
"Default": BMMinerS17Pro,
"BOSMiner+": BOSMinerS17Pro,
"BMMiner": BMMinerS17Pro,
"CGMiner": CGMinerS17Pro,
},
"Antminer S17e": {
"ANTMINER S17E": {
"Default": BMMinerS17e,
"BOSMiner+": BOSMinerS17e,
"BMMiner": BMMinerS17e,
"CGMiner": CGMinerS17e,
},
"Antminer T17": {
"ANTMINER T17": {
"Default": BMMinerT17,
"BOSMiner+": BOSMinerT17,
"BMMiner": BMMinerT17,
"CGMiner": CGMinerT17,
},
"Antminer T17+": {
"ANTMINER T17+": {
"Default": BMMinerT17Plus,
"BOSMiner+": BOSMinerT17Plus,
"BMMiner": BMMinerT17Plus,
"CGMiner": CGMinerT17Plus,
},
"Antminer T17e": {
"ANTMINER T17E": {
"Default": BMMinerT17e,
"BOSMiner+": BOSMinerT17e,
"BMMiner": BMMinerT17e,
"CGMiner": CGMinerT17e,
},
"Antminer S19": {
"ANTMINER S19": {
"Default": BMMinerS19,
"BOSMiner+": BOSMinerS19,
"BMMiner": BMMinerS19,
"CGMiner": CGMinerS19,
},
"Antminer S19 Pro": {
"ANTMINER S19 Pro": {
"Default": BMMinerS19Pro,
"BOSMiner+": BOSMinerS19Pro,
"BMMiner": BMMinerS19Pro,
"CGMiner": CGMinerS19Pro,
},
"Antminer S19j": {
"ANTMINER S19J": {
"Default": BMMinerS19j,
"BOSMiner+": BOSMinerS19j,
"BMMiner": BMMinerS19j,
"CGMiner": CGMinerS19j,
},
"Antminer S19j Pro": {
"ANTMINER S19J Pro": {
"Default": BMMinerS19jPro,
"BOSMiner+": BOSMinerS19jPro,
"BMMiner": BMMinerS19jPro,
"CGMiner": CGMinerS19jPro,
},
"Antminer S19a": {
"ANTMINER S19A": {
"Default": BMMinerS19a,
"BMMiner": BMMinerS19a,
},
"Antminer T19": {
"ANTMINER T19": {
"Default": BMMinerT19,
"BOSMiner+": BOSMinerT19,
"BMMiner": BMMinerT19,
"CGMiner": CGMinerT19,
},
"M20": {
"Default": BTMinerM20,
"BTMiner": BTMinerM20,
"10": BTMinerM20V10,
},
"M20S": {
"Default": BTMinerM20S,
"BTMiner": BTMinerM20S,
@@ -426,9 +431,9 @@ class MinerFactory(metaclass=Singleton):
if board_name:
if board_name == "am1-s9":
model = "Antminer S9"
model = "ANTMINER S9"
if board_name == "am2-s17":
model = "Antminer S17"
model = "ANTMINER S17"
api = "BOSMiner+"
return model, api, None
@@ -441,7 +446,7 @@ class MinerFactory(metaclass=Singleton):
if data.status_code == 200:
data = data.json()
if "minertype" in data.keys():
model = data["minertype"]
model = data["minertype"].upper()
if "bmminer" in "\t".join(data.keys()):
api = "BMMiner"
except Exception as e:
@@ -454,15 +459,15 @@ class MinerFactory(metaclass=Singleton):
# check for model, for most miners
if not devdetails["DEVDETAILS"][0]["Model"] == "":
# model of most miners
model = devdetails["DEVDETAILS"][0]["Model"]
model = devdetails["DEVDETAILS"][0]["Model"].upper()
# if model fails, try driver
else:
# some avalonminers have model in driver
model = devdetails["DEVDETAILS"][0]["Driver"]
model = devdetails["DEVDETAILS"][0]["Driver"].upper()
else:
if "s9" in devdetails["STATUS"][0]["Description"]:
model = "Antminer S9"
model = "ANTMINER S9"
# if we have version we can get API type from here
if version:
@@ -497,7 +502,7 @@ class MinerFactory(metaclass=Singleton):
# check for avalonminers
if version["VERSION"][0].get("PROD"):
_data = version["VERSION"][0]["PROD"].split("-")
model = _data[0]
model = _data[0].upper()
if len(data) > 1:
ver = _data[1]
elif version["VERSION"][0].get("MODEL"):
@@ -522,11 +527,11 @@ class MinerFactory(metaclass=Singleton):
):
# try to get "Type" which is model
if version["VERSION"][0].get("Type"):
model = version["VERSION"][0]["Type"]
model = version["VERSION"][0]["Type"].upper()
# braiins OS bug check just in case
elif "am2-s17" in version["STATUS"][0]["Description"]:
model = "Antminer S17"
model = "ANTMINER S17"
if model:
# whatsminer have a V in their version string (M20SV41), remove everything after it
@@ -535,7 +540,7 @@ class MinerFactory(metaclass=Singleton):
if len(_ver) > 1:
ver = model.split("V")[1]
model = model.split("V")[0]
# don't need "Bitmain", just "Antminer XX" as model
# don't need "Bitmain", just "ANTMINER XX" as model
if "Bitmain " in model:
model = model.replace("Bitmain ", "")
return model, api, ver

View File

@@ -0,0 +1,31 @@
# Copyright 2022 Upstream Data Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( # noqa - Ignore access to _module
M20,
M20V10,
)
class BTMinerM20(BTMiner, M20):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
class BTMinerM20V10(BTMiner, M20V10):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip

View File

@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .M20 import BTMinerM20, BTMinerM20V10
from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20
from .M20S_Plus import BTMinerM20SPlus

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyasic"
version = "0.13.2"
version = "0.14.1"
description = "A set of modules for interfacing with many common types of ASIC bitcoin miners, using both their API and SSH."
authors = ["UpstreamData <brett@upstreamdata.ca>"]
repository = "https://github.com/UpstreamData/pyasic"