add active field

This commit is contained in:
John-Paul Compagnone
2024-06-11 14:14:22 -04:00
parent a458adc45f
commit 677db8fd0d
2 changed files with 7 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ class HashBoard:
serial_number: The serial number of the board.
missing: Whether the board is returned from the miners data as a bool.
tuned: Whether the board is tuned as a bool.
active: Whether the board is currently tuning as a bool.
voltage: Current input voltage of the board as a float.
"""
@@ -46,6 +47,7 @@ class HashBoard:
serial_number: str = None
missing: bool = True
tuned: bool = None
active: bool = None
voltage: float = None
def get(self, __key: str, default: Any = None):

View File

@@ -311,9 +311,11 @@ class ePIC(ePICFirmware):
pass
tuned = True
active = False
if web_summary is not None:
tuner_running = web_summary["PerpetualTune"]["Running"]
if tuner_running:
active = True
algo_info = web_summary["PerpetualTune"]["Algorithm"]
if algo_info.get("VoltageOptimizer") is not None:
tuned = algo_info["VoltageOptimizer"].get("Optimized")
@@ -321,8 +323,10 @@ class ePIC(ePICFirmware):
tuned = algo_info["BoardTune"].get("Optimized")
else:
tuned = algo_info["ChipTune"].get("Optimized")
# To be extra detailed, also ensure the miner is in "Mining" state
tuned = tuned and web_summary["Status"]["Operating State"] == "Mining"
active = active and web_summary["Status"]["Operating State"] == "Mining"
hb_list = [
HashBoard(slot=i, expected_chips=self.expected_chips)
@@ -351,6 +355,7 @@ class ePIC(ePICFirmware):
hb_list[hb["Index"]].chips = num_of_chips
hb_list[hb["Index"]].temp = hb["Temperature"]
hb_list[hb["Index"]].tuned = tuned
hb_list[hb["Index"]].active = active
hb_list[hb["Index"]].voltage = hb["Input Voltage"]
return hb_list