fixed an issue with getting model causing an error because of whatsminers
This commit is contained in:
@@ -107,14 +107,21 @@ 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 data["STATUS"][0].get("STATUS") not in ["I", "S"]:
|
if not isinstance(data["STATUS"], str):
|
||||||
|
if data["STATUS"][0].get("STATUS") not in ["I", "S"]:
|
||||||
|
try:
|
||||||
|
data = await self._send_api_command(str(ip), "version")
|
||||||
|
model = data["VERSION"][0]["Type"]
|
||||||
|
except:
|
||||||
|
print(f"Get Model Exception: {ip}")
|
||||||
|
else:
|
||||||
|
model = data["DEVDETAILS"][0]["Model"]
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
data = await self._send_api_command(str(ip), "version")
|
data = await self._send_api_command(str(ip), "version")
|
||||||
model = data["VERSION"][0]["Type"]
|
model = data["VERSION"][0]["Type"]
|
||||||
except:
|
except:
|
||||||
print(f"Get Model Exception: {ip}")
|
print(f"Get Model Exception: {ip}")
|
||||||
else:
|
|
||||||
model = data["DEVDETAILS"][0]["Model"]
|
|
||||||
if model:
|
if model:
|
||||||
return model
|
return model
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user