bug: fix BTMiner not responding to pause_mining and resume_mining causing an exception.

This commit is contained in:
UpstreamData
2022-12-01 15:53:47 -07:00
parent ad5eb0cef6
commit 2a23acb73a

View File

@@ -196,14 +196,20 @@ class BTMiner(BaseMiner):
return False
async def stop_mining(self) -> bool:
data = await self.api.power_off(respbefore=True)
try:
data = await self.api.power_off(respbefore=True)
except APIError:
return False
if data.get("Msg"):
if data["Msg"] == "API command OK":
return True
return False
async def resume_mining(self) -> bool:
data = await self.api.power_on()
try:
data = await self.api.power_on()
except APIError:
return False
if data.get("Msg"):
if data["Msg"] == "API command OK":
return True