Skip to content

Commit

Permalink
feature: add support for goldshell shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rowan committed Feb 10, 2024
1 parent 09bc968 commit 3632c2c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion pyasic/miners/backends/goldshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ------------------------------------------------------------------------------
from typing import List

from pyasic.config import MinerConfig
from pyasic.config import MinerConfig, MiningModeConfig
from pyasic.data import HashBoard
from pyasic.errors import APIError
from pyasic.logger import logger
Expand Down Expand Up @@ -74,6 +74,8 @@ class GoldshellMiner(BFGMiner):

data_locations = GOLDSHELL_DATA_LOC

supports_shutdown = True

async def get_config(self) -> MinerConfig:
# get pool data
try:
Expand Down Expand Up @@ -183,3 +185,21 @@ async def _get_hashboards(
logger.error(self, rpc_devdetails)

return hashboards

async def stop_mining(self) -> bool:
settings = await self.web.setting()
mode = MiningModeConfig.sleep()
cfg = mode.as_goldshell()
for new_setting in cfg["settings"]:
settings[new_setting] = cfg["settings"][new_setting]
await self.web.set_setting(settings)
return True

async def resume_mining(self) -> bool:
settings = await self.web.setting()
mode = MiningModeConfig.normal()
cfg = mode.as_goldshell()
for new_setting in cfg["settings"]:
settings[new_setting] = cfg["settings"][new_setting]
await self.web.set_setting(settings)
return True

0 comments on commit 3632c2c

Please sign in to comment.