feature: add is_mining for bosminers.
This commit is contained in:
@@ -992,3 +992,22 @@ class BOSMiner(BaseMiner):
|
||||
)
|
||||
except (IndexError, KeyError):
|
||||
pass
|
||||
|
||||
async def is_mining(self, api_tunerstatus: dict = None) -> Optional[bool]:
|
||||
if not api_tunerstatus:
|
||||
try:
|
||||
api_tunerstatus = await self.api.tunerstatus()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if api_tunerstatus:
|
||||
try:
|
||||
running = any(
|
||||
[
|
||||
d["TunerRunning"]
|
||||
for d in api_tunerstatus["TUNERSTATUS"][0]["TunerChainStatus"]
|
||||
]
|
||||
)
|
||||
return running
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -345,6 +345,14 @@ class BaseMiner(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
async def is_mining(self, *args, **kwargs) -> Optional[bool]:
|
||||
"""Check whether the miner is mining
|
||||
|
||||
Returns:
|
||||
A boolean value representing if the miner is mining.
|
||||
"""
|
||||
return None
|
||||
|
||||
async def _get_data(self, allow_warning: bool, data_to_get: list = None) -> dict:
|
||||
if not data_to_get:
|
||||
# everything
|
||||
|
||||
Reference in New Issue
Block a user