feature: add wattage limit in get_config when getting config from whatsminers.

This commit is contained in:
UpstreamData
2022-12-02 15:57:31 -07:00
parent abd4d18a01
commit da47d72749

View File

@@ -238,16 +238,24 @@ class BTMiner(BaseMiner):
async def get_config(self) -> MinerConfig: async def get_config(self) -> MinerConfig:
pools = None pools = None
summary = None
cfg = MinerConfig() cfg = MinerConfig()
try: try:
pools = await self.api.pools() data = await self.api.multicommand("pools", "summary")
pools = data["pools"][0]
summary = data["summary"][0]
except APIError as e: except APIError as e:
logging.warning(e) logging.warning(e)
if pools: if pools:
if "POOLS" in pools.keys(): if "POOLS" in pools:
cfg = cfg.from_api(pools["POOLS"]) cfg = cfg.from_api(pools["POOLS"])
if summary:
if "SUMMARY" in summary:
if wattage := summary["SUMMARY"][0].get("Power Limit"):
cfg.autotuning_wattage = wattage
return cfg return cfg
async def get_data(self, allow_warning: bool = True) -> MinerData: async def get_data(self, allow_warning: bool = True) -> MinerData: