feature: add support for L3+ and Vnish L3+.
This commit is contained in:
@@ -28,25 +28,25 @@ from pyasic.errors import APIError
|
|||||||
from pyasic.miners.base import BaseMiner
|
from pyasic.miners.base import BaseMiner
|
||||||
|
|
||||||
BMMINER_DATA_LOC = {
|
BMMINER_DATA_LOC = {
|
||||||
"mac": {"cmd": "mac", "kwargs": {}},
|
"mac": {"cmd": "get_mac", "kwargs": {}},
|
||||||
"model": {"cmd": "model", "kwargs": {"api_devdetails": {"api": "devdetails"}}},
|
"model": {"cmd": "get_model", "kwargs": {"api_devdetails": {"api": "devdetails"}}},
|
||||||
"api_ver": {"cmd": "api_ver", "kwargs": {"api_version": {"api": "version"}}},
|
"api_ver": {"cmd": "get_api_ver", "kwargs": {"api_version": {"api": "version"}}},
|
||||||
"fw_ver": {"cmd": "fw_ver", "kwargs": {"api_version": {"api": "version"}}},
|
"fw_ver": {"cmd": "get_fw_ver", "kwargs": {"api_version": {"api": "version"}}},
|
||||||
"hostname": {"cmd": "hostname", "kwargs": {}},
|
"hostname": {"cmd": "get_hostname", "kwargs": {}},
|
||||||
"hashrate": {"cmd": "hashrate", "kwargs": {"api_summary": {"api": "summary"}}},
|
"hashrate": {"cmd": "get_hashrate", "kwargs": {"api_summary": {"api": "summary"}}},
|
||||||
"nominal_hashrate": {
|
"nominal_hashrate": {
|
||||||
"cmd": "nominal_hashrate",
|
"cmd": "get_nominal_hashrate",
|
||||||
"kwargs": {"api_stats": {"api": "stats"}},
|
"kwargs": {"api_stats": {"api": "stats"}},
|
||||||
},
|
},
|
||||||
"hashboards": {"cmd": "hashboards", "kwargs": {"api_stats": {"api": "stats"}}},
|
"hashboards": {"cmd": "get_hashboards", "kwargs": {"api_stats": {"api": "stats"}}},
|
||||||
"env_temp": {"cmd": "env_temp", "kwargs": {}},
|
"env_temp": {"cmd": "get_env_temp", "kwargs": {}},
|
||||||
"wattage": {"cmd": "wattage", "kwargs": {}},
|
"wattage": {"cmd": "get_wattage", "kwargs": {}},
|
||||||
"wattage_limit": {"cmd": "wattage_limit", "kwargs": {}},
|
"wattage_limit": {"cmd": "get_wattage_limit", "kwargs": {}},
|
||||||
"fans": {"cmd": "fans", "kwargs": {"api_stats": {"api": "stats"}}},
|
"fans": {"cmd": "get_fans", "kwargs": {"api_stats": {"api": "stats"}}},
|
||||||
"fan_psu": {"cmd": "fan_psu", "kwargs": {}},
|
"fan_psu": {"cmd": "get_fan_psu", "kwargs": {}},
|
||||||
"errors": {"cmd": "errors", "kwargs": {}},
|
"errors": {"cmd": "get_errors", "kwargs": {}},
|
||||||
"fault_light": {"cmd": "fault_light", "kwargs": {}},
|
"fault_light": {"cmd": "get_fault_light", "kwargs": {}},
|
||||||
"pools": {"cmd": "pools", "kwargs": {"api_pools": {"api": "pools"}}},
|
"pools": {"cmd": "get_pools", "kwargs": {"api_pools": {"api": "pools"}}},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
25
pyasic/miners/ltc/_types/antminer/X3/L3_Plus.py
Normal file
25
pyasic/miners/ltc/_types/antminer/X3/L3_Plus.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 L3Plus(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 = "L3+"
|
||||||
|
self.nominal_chips = 0
|
||||||
|
self.fan_count = 2
|
||||||
16
pyasic/miners/ltc/_types/antminer/X3/__init__.py
Normal file
16
pyasic/miners/ltc/_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 .L3_Plus import L3Plus
|
||||||
@@ -13,4 +13,5 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
from .X3 import *
|
||||||
from .X7 import *
|
from .X7 import *
|
||||||
|
|||||||
@@ -14,3 +14,4 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
from .bmminer import *
|
from .bmminer import *
|
||||||
|
from .vnish import *
|
||||||
|
|||||||
23
pyasic/miners/ltc/antminer/bmminer/X3/L3_Plus.py
Normal file
23
pyasic/miners/ltc/antminer/bmminer/X3/L3_Plus.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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.ltc._types import L3Plus # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class BMMinerL3Plus(AntminerOld, L3Plus):
|
||||||
|
def __init__(self, ip: str, api_ver: str = "0.0.0"):
|
||||||
|
super().__init__(ip, api_ver)
|
||||||
17
pyasic/miners/ltc/antminer/bmminer/X3/__init__.py
Normal file
17
pyasic/miners/ltc/antminer/bmminer/X3/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .L3_Plus import BMMinerL3Plus
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
from pyasic.miners.backends import AntminerModern
|
from pyasic.miners.backends import AntminerModern
|
||||||
from pyasic.miners.ltc._types import L7 # noqa - Ignore access to _module
|
from pyasic.miners.ltc._types import L7 # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,4 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
from .L7 import BMMinerL7
|
from .L7 import BMMinerL7
|
||||||
|
|||||||
@@ -13,4 +13,5 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
from .X3 import *
|
||||||
from .X7 import *
|
from .X7 import *
|
||||||
|
|||||||
23
pyasic/miners/ltc/antminer/vnish/X3/L3_Plus.py
Normal file
23
pyasic/miners/ltc/antminer/vnish/X3/L3_Plus.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 VNish
|
||||||
|
from pyasic.miners.ltc._types import L3Plus # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VnishL3Plus(VNish, L3Plus):
|
||||||
|
def __init__(self, ip: str, api_ver: str = "0.0.0"):
|
||||||
|
super().__init__(ip, api_ver)
|
||||||
17
pyasic/miners/ltc/antminer/vnish/X3/__init__.py
Normal file
17
pyasic/miners/ltc/antminer/vnish/X3/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 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 .L3_Plus import VnishL3Plus
|
||||||
16
pyasic/miners/ltc/antminer/vnish/__init__.py
Normal file
16
pyasic/miners/ltc/antminer/vnish/__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 *
|
||||||
@@ -54,6 +54,11 @@ MINER_CLASSES = {
|
|||||||
"Default": CGMinerHS3,
|
"Default": CGMinerHS3,
|
||||||
"CGMiner": CGMinerHS3,
|
"CGMiner": CGMinerHS3,
|
||||||
},
|
},
|
||||||
|
"ANTMINER L3+": {
|
||||||
|
"Default": BMMinerL3Plus,
|
||||||
|
"BMMiner": BMMinerL3Plus,
|
||||||
|
"VNish": VnishL3Plus,
|
||||||
|
},
|
||||||
"ANTMINER L7": {
|
"ANTMINER L7": {
|
||||||
"Default": BMMinerL7,
|
"Default": BMMinerL7,
|
||||||
"BMMiner": BMMinerL7,
|
"BMMiner": BMMinerL7,
|
||||||
@@ -632,9 +637,6 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
logging.warning(f"{ip}: Get Miner Timed Out")
|
logging.warning(f"{ip}: Get Miner Timed Out")
|
||||||
miner = self._select_miner_from_classes(ip, model, api, ver, api_ver)
|
miner = self._select_miner_from_classes(ip, model, api, ver, api_ver)
|
||||||
|
|
||||||
# once we have the miner, get the api and firmware version
|
|
||||||
# await miner.get_version()
|
|
||||||
|
|
||||||
# save the miner to the cache at its IP if its not unknown
|
# save the miner to the cache at its IP if its not unknown
|
||||||
if not isinstance(miner, UnknownMiner):
|
if not isinstance(miner, UnknownMiner):
|
||||||
self.miners[ip] = miner
|
self.miners[ip] = miner
|
||||||
@@ -700,6 +702,7 @@ 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}")
|
||||||
@@ -842,10 +845,17 @@ 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))
|
||||||
model = sysinfo["minertype"].upper()
|
model = sysinfo["minertype"].upper()
|
||||||
|
if "VNISH" in model:
|
||||||
|
api = "VNish"
|
||||||
|
for split_point in [" BB", " XILINX", " (VNISH"]:
|
||||||
|
if split_point in model:
|
||||||
|
model = model.split(split_point)[0]
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user