feature: sum hashrate in MinerData from hashboards, with the hashrate item being a backup.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user