feature: add support for goldshell mode settings.

This commit is contained in:
b-rowan
2024-02-10 14:23:17 -07:00
parent 34584ab098
commit 09bc9686ae
3 changed files with 19 additions and 2 deletions

View File

@@ -50,6 +50,9 @@ class MiningModeNormal(MinerConfigValue):
def as_epic(self) -> dict:
return {"ptune": {"enabled": False}}
def as_goldshell(self) -> dict:
return {"settings": {"select": 0}}
@dataclass
class MiningModeSleep(MinerConfigValue):
@@ -71,6 +74,9 @@ class MiningModeSleep(MinerConfigValue):
def as_epic(self) -> dict:
return {"ptune": {"algo": "Sleep", "target": 0}}
def as_goldshell(self) -> dict:
return {"settings": {"select": 2}}
@dataclass
class MiningModeLPM(MinerConfigValue):
@@ -89,6 +95,9 @@ class MiningModeLPM(MinerConfigValue):
def as_auradine(self) -> dict:
return {"mode": {"mode": "eco"}}
def as_goldshell(self) -> dict:
return {"settings": {"select": 1}}
@dataclass
class MiningModeHPM(MinerConfigValue):

View File

@@ -96,13 +96,18 @@ class GoldshellMiner(BFGMiner):
)
self.config = config
cfg = config.as_goldshell(user_suffix=user_suffix)
# send them back 1 at a time
for pool in config.as_goldshell(user_suffix=user_suffix)["pools"]:
for pool in cfg["pools"]:
await self.web.newpool(
url=pool["url"], user=pool["user"], password=pool["pass"]
)
settings = await self.web.setting()
for new_setting in cfg["settings"]:
settings[new_setting] = cfg["settings"][new_setting]
await self.web.set_setting(settings)
async def _get_mac(self, web_setting: dict = None) -> str:
if web_setting is None:
try:

View File

@@ -138,5 +138,8 @@ class GoldshellWebAPI(BaseWebAPI):
async def setting(self) -> dict:
return await self.send_command("setting")
async def set_setting(self, values: dict):
await self.send_command("setting", **values)
async def status(self) -> dict:
return await self.send_command("status")