From 677db8fd0d5211a378556442421efa7cadf8cc93 Mon Sep 17 00:00:00 2001 From: John-Paul Compagnone Date: Tue, 11 Jun 2024 14:14:22 -0400 Subject: [PATCH] add active field --- pyasic/data/boards.py | 2 ++ pyasic/miners/backends/epic.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/pyasic/data/boards.py b/pyasic/data/boards.py index 1d604697..4b22f21b 100644 --- a/pyasic/data/boards.py +++ b/pyasic/data/boards.py @@ -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): diff --git a/pyasic/miners/backends/epic.py b/pyasic/miners/backends/epic.py index 3e6f2545..a3c60fdc 100644 --- a/pyasic/miners/backends/epic.py +++ b/pyasic/miners/backends/epic.py @@ -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