fixed an issue with getting model causing an error because of whatsminers

This commit is contained in:
UpstreamData
2022-01-07 13:45:23 -07:00
parent 88539650ca
commit 25803b856d

View File

@@ -107,6 +107,7 @@ class MinerFactory:
try: try:
data = await self._send_api_command(str(ip), "devdetails") data = await self._send_api_command(str(ip), "devdetails")
if data.get("STATUS"): if data.get("STATUS"):
if not isinstance(data["STATUS"], str):
if data["STATUS"][0].get("STATUS") not in ["I", "S"]: if data["STATUS"][0].get("STATUS") not in ["I", "S"]:
try: try:
data = await self._send_api_command(str(ip), "version") data = await self._send_api_command(str(ip), "version")
@@ -115,6 +116,12 @@ class MinerFactory:
print(f"Get Model Exception: {ip}") print(f"Get Model Exception: {ip}")
else: else:
model = data["DEVDETAILS"][0]["Model"] model = data["DEVDETAILS"][0]["Model"]
else:
try:
data = await self._send_api_command(str(ip), "version")
model = data["VERSION"][0]["Type"]
except:
print(f"Get Model Exception: {ip}")
if model: if model:
return model return model
except OSError as e: except OSError as e: