Merge pull request #122 from jpcomps/fix_is_mining
feature: add is_mining for ePIC, add T21, add BlockMiner 720i
This commit is contained in:
@@ -94,7 +94,9 @@ class MinerData:
|
|||||||
percent_expected_wattage: float = field(init=False)
|
percent_expected_wattage: float = field(init=False)
|
||||||
nominal: bool = field(init=False)
|
nominal: bool = field(init=False)
|
||||||
config: MinerConfig = None
|
config: MinerConfig = None
|
||||||
errors: List[Union[WhatsminerError, BraiinsOSError, X19Error, InnosiliconError]] = field(default_factory=list)
|
errors: List[Union[WhatsminerError, BraiinsOSError, X19Error, InnosiliconError]] = (
|
||||||
|
field(default_factory=list)
|
||||||
|
)
|
||||||
fault_light: Union[bool, None] = None
|
fault_light: Union[bool, None] = None
|
||||||
efficiency: int = field(init=False)
|
efficiency: int = field(init=False)
|
||||||
is_mining: bool = True
|
is_mining: bool = True
|
||||||
|
|||||||
22
pyasic/miners/antminer/epic/X21/T21.py
Normal file
22
pyasic/miners/antminer/epic/X21/T21.py
Normal 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 ePIC
|
||||||
|
from pyasic.miners.models import T21
|
||||||
|
|
||||||
|
|
||||||
|
class ePICT21(ePIC, T21):
|
||||||
|
pass
|
||||||
@@ -17,3 +17,7 @@
|
|||||||
from .S21 import (
|
from .S21 import (
|
||||||
ePICS21,
|
ePICS21,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .T21 import (
|
||||||
|
ePICT21,
|
||||||
|
)
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ EPIC_DATA_LOC = DataLocations(
|
|||||||
"_get_uptime",
|
"_get_uptime",
|
||||||
[WebAPICommand("web_summary", "summary")],
|
[WebAPICommand("web_summary", "summary")],
|
||||||
),
|
),
|
||||||
|
str(DataOptions.IS_MINING): DataFunction(
|
||||||
|
"_is_mining",
|
||||||
|
[WebAPICommand("web_summary", "summary")],
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -313,8 +317,18 @@ class ePIC(BaseMiner):
|
|||||||
hb_list[hb["Index"]].temp = hb["Temperature"]
|
hb_list[hb["Index"]].temp = hb["Temperature"]
|
||||||
return hb_list
|
return hb_list
|
||||||
|
|
||||||
async def _is_mining(self, *args, **kwargs) -> Optional[bool]:
|
async def _is_mining(self, web_summary, *args, **kwargs) -> Optional[bool]:
|
||||||
return None
|
if web_summary is None:
|
||||||
|
try:
|
||||||
|
web_summary = await self.web.summary()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
if web_summary is not None:
|
||||||
|
try:
|
||||||
|
op_state = web_summary["Status"]["Operating State"]
|
||||||
|
return not op_state == "Idling"
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
async def _get_uptime(self, web_summary: dict = None) -> Optional[int]:
|
async def _get_uptime(self, web_summary: dict = None) -> Optional[int]:
|
||||||
if web_summary is None:
|
if web_summary is None:
|
||||||
|
|||||||
@@ -16,4 +16,5 @@
|
|||||||
|
|
||||||
from .blockminer import (
|
from .blockminer import (
|
||||||
ePICBlockMiner520i,
|
ePICBlockMiner520i,
|
||||||
|
ePICBlockMiner720i,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,12 @@
|
|||||||
|
|
||||||
from pyasic.miners.backends import ePIC
|
from pyasic.miners.backends import ePIC
|
||||||
from pyasic.miners.models import BlockMiner520i
|
from pyasic.miners.models import BlockMiner520i
|
||||||
|
from pyasic.miners.models import BlockMiner720i
|
||||||
|
|
||||||
|
|
||||||
class ePICBlockMiner520i(ePIC, BlockMiner520i):
|
class ePICBlockMiner520i(ePIC, BlockMiner520i):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ePICBlockMiner720i(ePIC, BlockMiner720i):
|
||||||
|
pass
|
||||||
|
|||||||
@@ -402,7 +402,9 @@ MINER_CLASSES = {
|
|||||||
"ANTMINER S19K PRO": ePICS19kPro,
|
"ANTMINER S19K PRO": ePICS19kPro,
|
||||||
"ANTMINER S19 XP": ePICS19XP,
|
"ANTMINER S19 XP": ePICS19XP,
|
||||||
"ANTMINER S21": ePICS21,
|
"ANTMINER S21": ePICS21,
|
||||||
|
"ANTMINER T21": ePICT21,
|
||||||
"BLOCKMINER 520I": ePICBlockMiner520i,
|
"BLOCKMINER 520I": ePICBlockMiner520i,
|
||||||
|
"BLOCKMINER 720I": ePICBlockMiner720i,
|
||||||
},
|
},
|
||||||
MinerTypes.HIVEON: {
|
MinerTypes.HIVEON: {
|
||||||
None: Hiveon,
|
None: Hiveon,
|
||||||
|
|||||||
23
pyasic/miners/models/antminer/X21/T21.py
Normal file
23
pyasic/miners/models/antminer/X21/T21.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.makes import AntMinerMake
|
||||||
|
|
||||||
|
|
||||||
|
class T21(AntMinerMake):
|
||||||
|
raw_model = "T21"
|
||||||
|
expected_chips = 108
|
||||||
|
expected_fans = 4
|
||||||
@@ -17,3 +17,6 @@
|
|||||||
from .S21 import (
|
from .S21 import (
|
||||||
S21,
|
S21,
|
||||||
)
|
)
|
||||||
|
from .T21 import (
|
||||||
|
T21,
|
||||||
|
)
|
||||||
|
|||||||
@@ -5,3 +5,9 @@ class BlockMiner520i(ePICMake):
|
|||||||
raw_model = "BlockMiner 520i"
|
raw_model = "BlockMiner 520i"
|
||||||
expected_chips = 124
|
expected_chips = 124
|
||||||
expected_fans = 4
|
expected_fans = 4
|
||||||
|
|
||||||
|
|
||||||
|
class BlockMiner720i(ePICMake):
|
||||||
|
raw_model = "BlockMiner 720i"
|
||||||
|
expected_chips = 180
|
||||||
|
expected_fans = 4
|
||||||
|
|||||||
Reference in New Issue
Block a user