feature: make mara discover more consistent.

This commit is contained in:
Upstream Data
2024-04-12 13:40:10 -06:00
parent 2c86b2da7e
commit d56da007a5
2 changed files with 13 additions and 4 deletions

View File

@@ -163,7 +163,7 @@ class MaraMiner(BaseMiner):
if web_overview is not None:
try:
return web_overview["version_firmware"].upper()
return web_overview["version_firmware"]
except LookupError:
pass
@@ -176,7 +176,7 @@ class MaraMiner(BaseMiner):
if web_network_config is not None:
try:
return web_network_config["hostname"].upper()
return web_network_config["hostname"]
except LookupError:
pass

View File

@@ -533,7 +533,7 @@ class MinerFactory:
async def _get_miner_type(self, ip: str) -> MinerTypes | None:
tasks = [
asyncio.create_task(self._get_miner_web(ip)),
asyncio.create_task(self._get_miner_socket(ip)),
# asyncio.create_task(self._get_miner_socket(ip)),
]
return await concurrent_get_first_result(tasks, lambda x: x is not None)
@@ -555,7 +555,16 @@ class MinerFactory:
and self._parse_web_type(x[0], x[1]) is not None,
)
if text is not None:
return self._parse_web_type(text, resp)
mtype = self._parse_web_type(text, resp)
if mtype == MinerTypes.ANTMINER:
# could still be mara
auth = httpx.DigestAuth("root", "root")
res = await self.send_web_command(
ip, "/kaonsu/v1/brief", auth=auth
)
if res is not None:
mtype = MinerTypes.MARATHON
return mtype
except asyncio.CancelledError:
for t in tasks:
t.cancel()