Compare commits

...

5 Commits

Author SHA1 Message Date
UpstreamData
9e2d3aeebd version: bump version number. 2023-05-16 16:09:17 -06:00
UpstreamData
0cead26872 feature: add support for S9j. 2023-05-16 16:08:49 -06:00
UpstreamData
706844264b version: bump version number. 2023-05-16 13:22:59 -06:00
UpstreamData
3257af975a bug: fix error with type hinting. 2023-05-16 13:21:39 -06:00
UpstreamData
83a4f86e15 bug: fix a bug with connection errors rarely being raised on read in API commands. 2023-05-12 10:46:43 -06:00
8 changed files with 60 additions and 3 deletions

View File

@@ -182,7 +182,10 @@ If you are sure you want to use this command please use API.send_command("{comma
writer.write(data)
logging.debug(f"{self} - ([Hidden] Send Bytes) - Draining")
await writer.drain()
ret_data = await asyncio.wait_for(reader.read(4096), timeout=timeout)
try:
ret_data = await asyncio.wait_for(reader.read(4096), timeout=timeout)
except ConnectionAbortedError:
return b"{}"
try:
# Fix for stupid whatsminer bug, reboot/restart seem to not load properly in the loop
# have to receive, save the data, check if there is more data by reading with a short timeout

View File

@@ -256,7 +256,7 @@ class BaseMiner(ABC):
pass
@abstractmethod
async def get_hashboards(self, *args, **kwargs) -> list[HashBoard]:
async def get_hashboards(self, *args, **kwargs) -> List[HashBoard]:
"""Get hashboard data from the miner in the form of [`HashBoard`][pyasic.data.HashBoard].
Returns:

View File

@@ -0,0 +1,26 @@
# ------------------------------------------------------------------------------
# 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 S9j(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 = "S9j"
self.nominal_chips = 63
self.fan_count = 2

View File

@@ -16,4 +16,5 @@
from .S9 import S9
from .S9i import S9i
from .S9j import S9j
from .T9 import T9

View File

@@ -0,0 +1,22 @@
# ------------------------------------------------------------------------------
# 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 BMMiner
from pyasic.miners.btc._types import S9j # noqa - Ignore access to _module
class BMMinerS9j(BMMiner, S9j):
pass

View File

@@ -16,4 +16,5 @@
from .S9 import BMMinerS9
from .S9i import BMMinerS9i
from .S9j import BMMinerS9j
from .T9 import BMMinerT9

View File

@@ -83,6 +83,10 @@ MINER_CLASSES = {
"Default": BMMinerS9i,
"BMMiner": BMMinerS9i,
},
"ANTMINER S9J": {
"Default": BMMinerS9j,
"BMMiner": BMMinerS9j,
},
"ANTMINER T9": {
"Default": BMMinerT9,
"BMMiner": BMMinerT9,

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyasic"
version = "0.33.11"
version = "0.33.13"
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"