bug: fix bosminer on X19 not reporting pause mode correctly.
This commit is contained in:
@@ -174,7 +174,7 @@ BOSMINER_DATA_LOC = {
|
|||||||
},
|
},
|
||||||
"is_mining": {
|
"is_mining": {
|
||||||
"cmd": "is_mining",
|
"cmd": "is_mining",
|
||||||
"kwargs": {"api_tunerstatus": {"api": "tunerstatus"}},
|
"kwargs": {"api_devdetails": {"api": "devdetails"}},
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
"cmd": "get_uptime",
|
"cmd": "get_uptime",
|
||||||
@@ -1072,22 +1072,16 @@ class BOSMiner(BaseMiner):
|
|||||||
except (IndexError, KeyError):
|
except (IndexError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def is_mining(self, api_tunerstatus: dict = None) -> Optional[bool]:
|
async def is_mining(self, api_devdetails: dict = None) -> Optional[bool]:
|
||||||
if not api_tunerstatus:
|
if not api_devdetails:
|
||||||
try:
|
try:
|
||||||
api_tunerstatus = await self.api.tunerstatus()
|
api_devdetails = await self.api.send_command("devdetails", ignore_errors=True, allow_warning=False)
|
||||||
except APIError:
|
except APIError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if api_tunerstatus:
|
if api_devdetails:
|
||||||
try:
|
try:
|
||||||
running = any(
|
return not api_devdetails["STATUS"][0]["Msg"] == "Unavailable"
|
||||||
[
|
|
||||||
d["TunerRunning"]
|
|
||||||
for d in api_tunerstatus["TUNERSTATUS"][0]["TunerChainStatus"]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
return running
|
|
||||||
except LookupError:
|
except LookupError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -427,23 +427,26 @@ class BaseMiner(ABC):
|
|||||||
fn_args = self.data_locations[data_name]["kwargs"]
|
fn_args = self.data_locations[data_name]["kwargs"]
|
||||||
args_to_send = {k: None for k in fn_args}
|
args_to_send = {k: None for k in fn_args}
|
||||||
for arg_name in fn_args:
|
for arg_name in fn_args:
|
||||||
if fn_args[arg_name].get("api"):
|
try:
|
||||||
if api_command_data.get("multicommand"):
|
if fn_args[arg_name].get("api"):
|
||||||
args_to_send[arg_name] = api_command_data[
|
if api_command_data.get("multicommand"):
|
||||||
fn_args[arg_name]["api"]
|
args_to_send[arg_name] = api_command_data[
|
||||||
][0]
|
fn_args[arg_name]["api"]
|
||||||
else:
|
][0]
|
||||||
args_to_send[arg_name] = api_command_data
|
|
||||||
if fn_args[arg_name].get("web"):
|
|
||||||
if web_command_data is not None:
|
|
||||||
if web_command_data.get("multicommand"):
|
|
||||||
args_to_send[arg_name] = web_command_data[
|
|
||||||
fn_args[arg_name]["web"]
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
if not web_command_data == {"multicommand": False}:
|
args_to_send[arg_name] = api_command_data
|
||||||
args_to_send[arg_name] = web_command_data
|
if fn_args[arg_name].get("web"):
|
||||||
except (KeyError, IndexError):
|
if web_command_data is not None:
|
||||||
|
if web_command_data.get("multicommand"):
|
||||||
|
args_to_send[arg_name] = web_command_data[
|
||||||
|
fn_args[arg_name]["web"]
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
if not web_command_data == {"multicommand": False}:
|
||||||
|
args_to_send[arg_name] = web_command_data
|
||||||
|
except LookupError:
|
||||||
|
args_to_send[arg_name] = None
|
||||||
|
except LookupError as e:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
function = getattr(self, self.data_locations[data_name]["cmd"])
|
function = getattr(self, self.data_locations[data_name]["cmd"])
|
||||||
|
|||||||
Reference in New Issue
Block a user