feature: add uptime check for some miners, and fix a bug with get_mac on BOS.

This commit is contained in:
UpstreamData
2023-06-27 09:35:07 -06:00
parent bf3bd7c2b9
commit df3a080c9d
15 changed files with 158 additions and 2 deletions

View File

@@ -46,6 +46,10 @@ BMMINER_DATA_LOC = {
"fault_light": {"cmd": "get_fault_light", "kwargs": {}},
"pools": {"cmd": "get_pools", "kwargs": {"api_pools": {"api": "pools"}}},
"is_mining": {"cmd": "is_mining", "kwargs": {}},
"uptime": {
"cmd": "get_uptime",
"kwargs": {"api_stats": {"api": "stats"}},
},
}
@@ -356,3 +360,16 @@ class BMMiner(BaseMiner):
async def is_mining(self, *args, **kwargs) -> Optional[bool]:
return None
async def get_uptime(self, api_stats: dict = None) -> Optional[int]:
if not api_stats:
try:
api_stats = await self.web.get_miner_conf()
except APIError:
pass
if api_stats:
try:
return int(api_stats["STATS"][0]["Elapsed"])
except LookupError:
pass