bug: fix issues with new versions of braiins OS, and fix bugs with innosilicon miners not returning much data at all.
This commit is contained in:
@@ -483,10 +483,12 @@ class BOSMiner(BaseMiner):
|
|||||||
api_devs = d["devs"][0]
|
api_devs = d["devs"][0]
|
||||||
except (KeyError, IndexError):
|
except (KeyError, IndexError):
|
||||||
api_devs = None
|
api_devs = None
|
||||||
|
print(api_devdetails)
|
||||||
|
print(api_devs)
|
||||||
|
print(api_temps)
|
||||||
if api_temps:
|
if api_temps:
|
||||||
try:
|
try:
|
||||||
offset = 6 if api_temps["TEMPS"][0]["ID"] in [6, 7, 8] else 0
|
offset = 6 if api_temps["TEMPS"][0]["ID"] in [6, 7, 8] else 1
|
||||||
|
|
||||||
for board in api_temps["TEMPS"]:
|
for board in api_temps["TEMPS"]:
|
||||||
_id = board["ID"] - offset
|
_id = board["ID"] - offset
|
||||||
@@ -499,7 +501,7 @@ class BOSMiner(BaseMiner):
|
|||||||
|
|
||||||
if api_devdetails:
|
if api_devdetails:
|
||||||
try:
|
try:
|
||||||
offset = 6 if api_devdetails["DEVDETAILS"][0]["ID"] in [6, 7, 8] else 0
|
offset = 6 if api_devdetails["DEVDETAILS"][0]["ID"] in [6, 7, 8] else 1
|
||||||
|
|
||||||
for board in api_devdetails["DEVDETAILS"]:
|
for board in api_devdetails["DEVDETAILS"]:
|
||||||
_id = board["ID"] - offset
|
_id = board["ID"] - offset
|
||||||
@@ -511,7 +513,7 @@ class BOSMiner(BaseMiner):
|
|||||||
|
|
||||||
if api_devs:
|
if api_devs:
|
||||||
try:
|
try:
|
||||||
offset = 6 if api_devs["DEVS"][0]["ID"] in [6, 7, 8] else 0
|
offset = 6 if api_devs["DEVS"][0]["ID"] in [6, 7, 8] else 1
|
||||||
|
|
||||||
for board in api_devs["DEVS"]:
|
for board in api_devs["DEVS"]:
|
||||||
_id = board["ID"] - offset
|
_id = board["ID"] - offset
|
||||||
|
|||||||
@@ -136,10 +136,10 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
|
|
||||||
async def get_mac(
|
async def get_mac(
|
||||||
self,
|
self,
|
||||||
web_getAll: dict = None,
|
web_getAll: dict = None, # noqa
|
||||||
web_overview: dict = None, # noqa: named this way for automatic functionality
|
web_overview: dict = None, # noqa: named this way for automatic functionality
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
web_all_data = web_getAll
|
web_all_data = web_getAll.get("all")
|
||||||
if not web_all_data and not web_overview:
|
if not web_all_data and not web_overview:
|
||||||
try:
|
try:
|
||||||
web_overview = await self.send_web_command("overview")
|
web_overview = await self.send_web_command("overview")
|
||||||
@@ -183,7 +183,7 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
api_summary: dict = None,
|
api_summary: dict = None,
|
||||||
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
||||||
) -> Optional[float]:
|
) -> Optional[float]:
|
||||||
web_all_data = web_getAll
|
web_all_data = web_getAll.get("all")
|
||||||
if not api_summary and not web_all_data:
|
if not api_summary and not web_all_data:
|
||||||
try:
|
try:
|
||||||
api_summary = await self.api.summary()
|
api_summary = await self.api.summary()
|
||||||
@@ -209,7 +209,7 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
api_stats: dict = None,
|
api_stats: dict = None,
|
||||||
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
||||||
) -> List[HashBoard]:
|
) -> List[HashBoard]:
|
||||||
web_all_data = web_getAll
|
web_all_data = web_getAll.get("all")
|
||||||
hashboards = [
|
hashboards = [
|
||||||
HashBoard(slot=i, expected_chips=self.nominal_chips)
|
HashBoard(slot=i, expected_chips=self.nominal_chips)
|
||||||
for i in range(self.ideal_hashboards)
|
for i in range(self.ideal_hashboards)
|
||||||
@@ -231,8 +231,9 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
|
|
||||||
if api_stats:
|
if api_stats:
|
||||||
if api_stats.get("STATS"):
|
if api_stats.get("STATS"):
|
||||||
for idx, board in enumerate(api_stats["STATS"]):
|
for board in api_stats["STATS"]:
|
||||||
try:
|
try:
|
||||||
|
idx = board["Chain ID"]
|
||||||
chips = board["Num active chips"]
|
chips = board["Num active chips"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
@@ -242,25 +243,31 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
|
|
||||||
if web_all_data:
|
if web_all_data:
|
||||||
if web_all_data.get("chain"):
|
if web_all_data.get("chain"):
|
||||||
for idx, board in enumerate(web_all_data["chain"]):
|
for board in web_all_data["chain"]:
|
||||||
temp = board.get("Temp min")
|
idx = board.get("ASC")
|
||||||
if temp:
|
if idx is not None:
|
||||||
hashboards[idx].temp = round(temp)
|
temp = board.get("Temp min")
|
||||||
|
if temp:
|
||||||
|
hashboards[idx].temp = round(temp)
|
||||||
|
|
||||||
hashrate = board.get("Hash Rate H")
|
hashrate = board.get("Hash Rate H")
|
||||||
if hashrate:
|
if hashrate:
|
||||||
hashboards[idx].hashrate = round(hashrate / 1000000000000, 2)
|
hashboards[idx].hashrate = round(
|
||||||
|
hashrate / 1000000000000, 2
|
||||||
|
)
|
||||||
|
|
||||||
chip_temp = board.get("Temp max")
|
chip_temp = board.get("Temp max")
|
||||||
if chip_temp:
|
if chip_temp:
|
||||||
hashboards[idx].chip_temp = round(chip_temp)
|
hashboards[idx].chip_temp = round(chip_temp)
|
||||||
|
|
||||||
return hashboards
|
return hashboards
|
||||||
|
|
||||||
async def get_wattage(
|
async def get_wattage(
|
||||||
self, web_getAll: dict = None
|
self,
|
||||||
) -> Optional[int]: # noqa: named this way for automatic functionality
|
web_getAll: dict = None,
|
||||||
web_all_data = web_getAll
|
api_stats: dict = None, # noqa: named this way for automatic functionality
|
||||||
|
) -> Optional[int]:
|
||||||
|
web_all_data = web_getAll.get("all")
|
||||||
if not web_all_data:
|
if not web_all_data:
|
||||||
try:
|
try:
|
||||||
web_all_data = await self.send_web_command("getAll")
|
web_all_data = await self.send_web_command("getAll")
|
||||||
@@ -275,11 +282,28 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if not api_stats:
|
||||||
|
try:
|
||||||
|
api_stats = await self.api.stats()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if api_stats:
|
||||||
|
if api_stats.get("STATS"):
|
||||||
|
for board in api_stats["STATS"]:
|
||||||
|
try:
|
||||||
|
wattage = board["power"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
wattage = int(wattage)
|
||||||
|
return wattage
|
||||||
|
|
||||||
async def get_fans(
|
async def get_fans(
|
||||||
self,
|
self,
|
||||||
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
web_getAll: dict = None, # noqa: named this way for automatic functionality
|
||||||
) -> List[Fan]:
|
) -> List[Fan]:
|
||||||
web_all_data = web_getAll
|
web_all_data = web_getAll.get("all")
|
||||||
if not web_all_data:
|
if not web_all_data:
|
||||||
try:
|
try:
|
||||||
web_all_data = await self.send_web_command("getAll")
|
web_all_data = await self.send_web_command("getAll")
|
||||||
@@ -350,3 +374,24 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
|
|||||||
if not err == 0:
|
if not err == 0:
|
||||||
errors.append(InnosiliconError(error_code=err))
|
errors.append(InnosiliconError(error_code=err))
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
async def get_wattage_limit(self, web_getAll: dict = None) -> Optional[int]:
|
||||||
|
web_all_data = web_getAll.get("all")
|
||||||
|
if not web_all_data:
|
||||||
|
try:
|
||||||
|
web_all_data = await self.send_web_command("getAll")
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
web_all_data = web_all_data["all"]
|
||||||
|
|
||||||
|
if web_all_data:
|
||||||
|
try:
|
||||||
|
level = web_all_data["running_mode"]["level"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# this is very possibly not correct.
|
||||||
|
level = int(level)
|
||||||
|
limit = 1250 + (250 * level)
|
||||||
|
return limit
|
||||||
|
|||||||
Reference in New Issue
Block a user