add fan_psu to MinerData, only works for whatsminers.

This commit is contained in:
UpstreamData
2022-10-12 15:42:27 -06:00
parent 3363bdc592
commit 5e2a18f91e
2 changed files with 25 additions and 11 deletions

View File

@@ -49,6 +49,7 @@ class MinerData:
fan_2: The speed of the second fan as an int.
fan_3: The speed of the third fan as an int.
fan_4: The speed of the fourth fan as an int.
fan_psu: The speed of the PSU on the fan if the miner collects it.
left_chips: The number of chips online in the left board as an int.
center_chips: The number of chips online in the left board as an int.
right_chips: The number of chips online in the left board as an int.
@@ -76,19 +77,20 @@ class MinerData:
center_board_hashrate: float = 0.0
right_board_hashrate: float = 0.0
temperature_avg: int = field(init=False)
env_temp: float = 0.0
left_board_temp: int = 0
left_board_chip_temp: int = 0
center_board_temp: int = 0
center_board_chip_temp: int = 0
right_board_temp: int = 0
right_board_chip_temp: int = 0
wattage: int = 0
wattage_limit: int = 0
env_temp: float = -1.0
left_board_temp: int = -1
left_board_chip_temp: int = -1
center_board_temp: int = -1
center_board_chip_temp: int = -1
right_board_temp: int = -1
right_board_chip_temp: int = -1
wattage: int = -1
wattage_limit: int = -1
fan_1: int = -1
fan_2: int = -1
fan_3: int = -1
fan_4: int = -1
fan_psu: int = -1
left_chips: int = 0
center_chips: int = 0
right_chips: int = 0
@@ -192,7 +194,7 @@ class MinerData:
self.center_board_chip_temp,
self.right_board_chip_temp,
]:
if temp and not temp == 0:
if temp and not temp == -1:
total_temp += temp
temp_count += 1
if not temp_count > 0:

View File

@@ -260,7 +260,9 @@ class BTMiner(BaseMiner):
miner_data = None
for i in range(PyasicSettings().miner_get_data_retries):
try:
miner_data = await self.api.multicommand("summary", "devs", "pools")
miner_data = await self.api.multicommand(
"summary", "devs", "pools", "get_psu"
)
if miner_data:
break
except APIError:
@@ -272,6 +274,7 @@ class BTMiner(BaseMiner):
summary = miner_data.get("summary")[0]
devs = miner_data.get("devs")[0]
pools = miner_data.get("pools")[0]
psu_data = miner_data.get("get_psu")[0]
if summary:
summary_data = summary.get("SUMMARY")
@@ -287,6 +290,9 @@ class BTMiner(BaseMiner):
if summary_data[0].get("Power Limit"):
wattage_limit = summary_data[0]["Power Limit"]
if summary_data[0].get("Power Fanspeed"):
data.fan_psu = summary_data[0]["Power Fanspeed"]
data.fan_1 = summary_data[0]["Fan Speed In"]
data.fan_2 = summary_data[0]["Fan Speed Out"]
@@ -312,6 +318,12 @@ class BTMiner(BaseMiner):
)
)
if psu_data:
psu = psu_data.get("Msg")
if psu:
if psu.get("fan_speed"):
data.fan_psu = psu["fan_speed"]
if devs:
temp_data = devs.get("DEVS")
if temp_data: