bug: fix support for new miners that return a BOSer string in version data.

This commit is contained in:
UpstreamData
2022-11-14 09:10:18 -07:00
parent 65ecf1fea2
commit 9c7ab5ac57

View File

@@ -432,11 +432,14 @@ class MinerFactory(metaclass=Singleton):
# if we have devdetails, we can get model data from there # if we have devdetails, we can get model data from there
if devdetails: if devdetails:
if devdetails == {"Msg": "Disconnected"}: try:
model = await self.__get_model_from_graphql(ip) if devdetails[0]["STATUS"][0]["Msg"]:
if model: model = await self.__get_model_from_graphql(ip)
api = "BOSMiner+" if model:
return model, api, ver api = "BOSMiner+"
return model, api, ver
except (KeyError, TypeError, ValueError, IndexError):
pass
for _devdetails_key in ["Model", "Driver"]: for _devdetails_key in ["Model", "Driver"]:
try: try:
@@ -454,6 +457,14 @@ class MinerFactory(metaclass=Singleton):
# if we have version we can get API type from here # if we have version we can get API type from here
if version: if version:
try:
if version[0]["STATUS"][0]["Msg"]:
model = await self.__get_model_from_graphql(ip)
if model:
api = "BOSMiner+"
return model, api, ver
except (KeyError, TypeError, ValueError, IndexError):
pass
if "VERSION" in version: if "VERSION" in version:
api_types = ["BMMiner", "CGMiner", "BTMiner"] api_types = ["BMMiner", "CGMiner", "BTMiner"]
# check basic API types, BOSMiner needs a special check # check basic API types, BOSMiner needs a special check
@@ -469,6 +480,8 @@ class MinerFactory(metaclass=Singleton):
api = "BOSMiner+" api = "BOSMiner+"
if "BOSminer+" in version["VERSION"][0]: if "BOSminer+" in version["VERSION"][0]:
api = "BOSMiner+" api = "BOSMiner+"
if any("BOSer" in string for string in version["VERSION"][0]):
api = "BOSMiner+"
# check for avalonminers # check for avalonminers
for _version_key in ["PROD", "MODEL"]: for _version_key in ["PROD", "MODEL"]:
@@ -547,7 +560,7 @@ class MinerFactory(metaclass=Singleton):
if not validation[0]: if not validation[0]:
try: try:
if data["version"][0]["STATUS"][0]["Msg"] == "Disconnected": if data["version"][0]["STATUS"][0]["Msg"] == "Disconnected":
return {"Msg": "Disconnected"}, None return data["devdetails"], data["version"]
except KeyError: except KeyError:
pass pass
raise APIError(validation[1]) raise APIError(validation[1])