bug: fix for btminer get_data() for cases where arbitrary amounts of errors with no error information are returned from the api to have them not be added to the error list.

This commit is contained in:
Upstream Data
2022-10-30 21:17:26 -06:00
parent 53ff3c5f79
commit 7bd5e49412

View File

@@ -163,9 +163,12 @@ class BTMiner(BaseMiner):
if summary_data[0].get("Error Code Count"):
for i in range(summary_data[0]["Error Code Count"]):
if summary_data[0].get(f"Error Code {i}"):
data.append(
WhatsminerError(error_code=summary_data[0][f"Error Code {i}"])
)
if not summary_data[0][f"Error Code {i}"] == "":
data.append(
WhatsminerError(
error_code=summary_data[0][f"Error Code {i}"]
)
)
return data
async def reboot(self) -> bool:
@@ -312,11 +315,14 @@ class BTMiner(BaseMiner):
if summary_data[0].get("Error Code Count"):
for i in range(summary_data[0]["Error Code Count"]):
if summary_data[0].get(f"Error Code {i}"):
data.errors.append(
WhatsminerError(
error_code=summary_data[0][f"Error Code {i}"]
if not summary_data[0][f"Error Code {i}"] == "":
data.errors.append(
WhatsminerError(
error_code=summary_data[0][
f"Error Code {i}"
]
)
)
)
if psu_data:
psu = psu_data.get("Msg")