feature: add is_mining for bosminers.

This commit is contained in:
UpstreamData
2023-06-23 12:39:00 -06:00
parent 4530d086da
commit d06cb19da3
2 changed files with 27 additions and 0 deletions

View File

@@ -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

View File

@@ -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