feature: add support for antminer D3.
This commit is contained in:
16
pyasic/miners/dsh/__init__.py
Normal file
16
pyasic/miners/dsh/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .antminer import *
|
||||||
16
pyasic/miners/dsh/_types/__init__.py
Normal file
16
pyasic/miners/dsh/_types/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .antminer import *
|
||||||
27
pyasic/miners/dsh/_types/antminer/X3/D3.py
Normal file
27
pyasic/miners/dsh/_types/antminer/X3/D3.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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.makes import AntMiner
|
||||||
|
|
||||||
|
|
||||||
|
class D3(AntMiner): # noqa - ignore ABC method implementation
|
||||||
|
def __init__(self, ip: str, api_ver: str = "0.0.0"):
|
||||||
|
super().__init__(ip, api_ver)
|
||||||
|
self.ip = ip
|
||||||
|
self.model = "D3"
|
||||||
|
self.nominal_chips = 60
|
||||||
|
self.ideal_hashboards = 3
|
||||||
|
self.fan_count = 2
|
||||||
16
pyasic/miners/dsh/_types/antminer/X3/__init__.py
Normal file
16
pyasic/miners/dsh/_types/antminer/X3/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .D3 import D3
|
||||||
16
pyasic/miners/dsh/_types/antminer/__init__.py
Normal file
16
pyasic/miners/dsh/_types/antminer/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .X3 import *
|
||||||
16
pyasic/miners/dsh/antminer/__init__.py
Normal file
16
pyasic/miners/dsh/antminer/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .cgminer import *
|
||||||
24
pyasic/miners/dsh/antminer/cgminer/X3/D3.py
Normal file
24
pyasic/miners/dsh/antminer/cgminer/X3/D3.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 AntminerOld
|
||||||
|
from pyasic.miners.dsh._types import D3 # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class CGMinerD3(AntminerOld, D3):
|
||||||
|
def __init__(self, ip: str, api_ver: str = "0.0.0"):
|
||||||
|
super().__init__(ip, api_ver)
|
||||||
|
self.supports_shutdown = False
|
||||||
16
pyasic/miners/dsh/antminer/cgminer/X3/__init__.py
Normal file
16
pyasic/miners/dsh/antminer/cgminer/X3/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .D3 import CGMinerD3
|
||||||
16
pyasic/miners/dsh/antminer/cgminer/__init__.py
Normal file
16
pyasic/miners/dsh/antminer/cgminer/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .X3 import *
|
||||||
@@ -21,5 +21,5 @@ class L3Plus(AntMiner): # noqa - ignore ABC method implementation
|
|||||||
super().__init__(ip, api_ver)
|
super().__init__(ip, api_ver)
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.model = "L3+"
|
self.model = "L3+"
|
||||||
self.nominal_chips = 0
|
self.nominal_chips = 72
|
||||||
self.fan_count = 2
|
self.fan_count = 2
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ from pyasic.miners.base import AnyMiner
|
|||||||
from pyasic.miners.btc import *
|
from pyasic.miners.btc import *
|
||||||
from pyasic.miners.ckb import *
|
from pyasic.miners.ckb import *
|
||||||
from pyasic.miners.dcr import *
|
from pyasic.miners.dcr import *
|
||||||
|
from pyasic.miners.dsh import *
|
||||||
from pyasic.miners.etc import *
|
from pyasic.miners.etc import *
|
||||||
from pyasic.miners.hns import *
|
from pyasic.miners.hns import *
|
||||||
from pyasic.miners.kda import *
|
from pyasic.miners.kda import *
|
||||||
@@ -50,6 +51,10 @@ MINER_CLASSES = {
|
|||||||
"Default": CGMinerDR5,
|
"Default": CGMinerDR5,
|
||||||
"CGMiner": CGMinerDR5,
|
"CGMiner": CGMinerDR5,
|
||||||
},
|
},
|
||||||
|
"ANTMINER D3": {
|
||||||
|
"Default": CGMinerD3,
|
||||||
|
"CGMiner": CGMinerD3,
|
||||||
|
},
|
||||||
"ANTMINER HS3": {
|
"ANTMINER HS3": {
|
||||||
"Default": CGMinerHS3,
|
"Default": CGMinerHS3,
|
||||||
"CGMiner": CGMinerHS3,
|
"CGMiner": CGMinerHS3,
|
||||||
@@ -702,7 +707,6 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
devdetails, version = await self.__get_devdetails_and_version(ip)
|
devdetails, version = await self.__get_devdetails_and_version(ip)
|
||||||
print(devdetails, version)
|
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
# catch APIError and let the factory know we cant get data
|
# catch APIError and let the factory know we cant get data
|
||||||
logging.warning(f"{ip}: API Command Error: {e}")
|
logging.warning(f"{ip}: API Command Error: {e}")
|
||||||
@@ -845,7 +849,6 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
if version and not model:
|
if version and not model:
|
||||||
try:
|
try:
|
||||||
model = version["VERSION"][0]["Type"].upper()
|
model = version["VERSION"][0]["Type"].upper()
|
||||||
print(model)
|
|
||||||
if "ANTMINER BHB" in model:
|
if "ANTMINER BHB" in model:
|
||||||
# def antminer, get from web
|
# def antminer, get from web
|
||||||
sysinfo = await self.__get_system_info_from_web(str(ip))
|
sysinfo = await self.__get_system_info_from_web(str(ip))
|
||||||
|
|||||||
Reference in New Issue
Block a user