feature: sum hashrate in MinerData from hashboards, with the hashrate item being a backup.

This commit is contained in:
UpstreamData
2023-04-13 14:26:03 -06:00
parent 05e82b85c5
commit 853756ebcb
2 changed files with 12 additions and 2 deletions

View File

@@ -116,7 +116,8 @@ class MinerData:
api_ver: str = "Unknown"
fw_ver: str = "Unknown"
hostname: str = "Unknown"
hashrate: float = 0
hashrate: float = field(init=False)
_hashrate: float = field(init=False)
nominal_hashrate: float = 0
hashboards: List[HashBoard] = field(default_factory=list)
ideal_hashboards: int = 1
@@ -213,6 +214,16 @@ class MinerData:
setattr(cp, key, item & other_item)
return cp
@property
def hashrate(self): # noqa - Skip PyCharm inspection
if len(self.hashboards) > 0:
return round(sum(map(lambda x: x.hashrate, self.hashboards)), 2)
return self._hashrate
@hashrate.setter
def hashrate(self, val):
self._hashrate = val
@property
def fan_1(self): # noqa - Skip PyCharm inspection
if len(self.fans) > 0:

View File

@@ -69,7 +69,6 @@ class HiveonT9(Hiveon, T9):
try:
hashrate += api_stats["STATS"][1][f"chain_rate{chipset}"]
chips += api_stats["STATS"][1][f"chain_acn{chipset}"]
print(chips)
except (KeyError, IndexError):
pass
hashboard.hashrate = round(hashrate / 1000, 2)