added changing model when configuring for BOS S9s

This commit is contained in:
UpstreamData
2022-03-25 08:58:02 -06:00
parent 02581e917d
commit c3b23313ba
6 changed files with 45 additions and 24 deletions

View File

@@ -185,4 +185,4 @@ async def general_config_convert_bos(yaml_config):
out_config["power_scaling"]["shutdown_duration"] = config[opt]["shutdown_duration"]
else:
out_config["power_scaling"]["shutdown_duration"] = 3.0
return toml.dumps(out_config)
return out_config

View File

@@ -1,4 +1,8 @@
import logging
import toml
from miners.bosminer import BOSMiner
from config.bos import general_config_convert_bos
class BOSMinerS9(BOSMiner):
@@ -9,3 +13,18 @@ class BOSMinerS9(BOSMiner):
def __repr__(self) -> str:
return f"BOSminerS9: {str(self.ip)}"
async def send_config(self, yaml_config) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.")
conf = await general_config_convert_bos(yaml_config)
toml_conf = toml.dumps(conf)
conf["format"]["model"] = "Antminer S9"
async with (await self._get_ssh_connection()) as conn:
logging.debug(f"{self}: Opening SFTP connection.")
async with conn.start_sftp_client() as sftp:
logging.debug(f"{self}: Opening config file.")
async with sftp.open('/etc/bosminer.toml', 'w+') as file:
await file.write(toml_conf)
logging.debug(f"{self}: Restarting BOSMiner")
await conn.run("/etc/init.d/bosminer restart")

View File

@@ -107,7 +107,7 @@ class BOSMiner(BaseMiner):
async def send_config(self, yaml_config) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.")
toml_conf = await general_config_convert_bos(yaml_config)
toml_conf = toml.dumps(await general_config_convert_bos(yaml_config))
async with (await self._get_ssh_connection()) as conn:
logging.debug(f"{self}: Opening SFTP connection.")
async with conn.start_sftp_client() as sftp:

View File

@@ -80,7 +80,7 @@ async def import_config_file(file_location):
async def export_config_file(file_location, config):
await update_ui_with_data("status", "Exporting")
config = await general_config_convert_bos(config)
config = toml.dumps(await general_config_convert_bos(config))
config = toml.loads(config)
config['format']['generator'] = 'upstream_config_util'
config['format']['timestamp'] = int(time.time())

View File

@@ -16,12 +16,13 @@ from settings import CFG_UTIL_CONFIG_THREADS as CONFIG_THREADS, CFG_UTIL_REBOOT_
async def import_config(idx):
await update_ui_with_data("status", "Importing")
logging.debug(f"{window['ip_table'].Values[idx[0]][0]}: Importing config.")
miner = await MinerFactory().get_miner(ipaddress.ip_address(window["ip_table"].Values[idx[0]][0]))
miner_ip = window['ip_table'].Values[idx[0]][0]
logging.debug(f"{miner_ip}: Importing config.")
miner = await MinerFactory().get_miner(ipaddress.ip_address(miner_ip))
await miner.get_config()
config = miner.config
await update_ui_with_data("config", str(config))
logging.debug(f"{window['ip_table'].Values[idx[0]][0]}: Config import completed.")
logging.debug(f"{miner_ip}: Config import completed.")
await update_ui_with_data("status", "")
@@ -462,7 +463,8 @@ async def generate_config(username, workername, v2_allowed):
url_2 = 'stratum+tcp://us-east.stratum.slushpool.com:3333'
url_3 = 'stratum+tcp://stratum.slushpool.com:3333'
config = {'group': [{
config = {
'group': [{
'name': 'group',
'quota': 1,
'pool': [{

View File

@@ -10,7 +10,7 @@
<script>
if (!window.WebSocket) alert("WebSocket not supported by this browser");
var ws = new WebSocket("ws://{{request.url.hostname}}:80/dashboard/ws");
var ws = new WebSocket("ws://{{request.url.hostname}}:10000/dashboard/ws");
let all_data = []
let all_labels = []
ws.onmessage = function(event) {