fixed a bug with using safe parse api data not returning properly in the get formatted data function
This commit is contained in:
@@ -14,6 +14,8 @@ from cfg_util.func.data import safe_parse_api_data
|
|||||||
|
|
||||||
from config.bos import bos_config_convert, general_config_convert_bos
|
from config.bos import bos_config_convert, general_config_convert_bos
|
||||||
|
|
||||||
|
from API import APIError
|
||||||
|
|
||||||
|
|
||||||
async def update_ui_with_data(key, data, append=False):
|
async def update_ui_with_data(key, data, append=False):
|
||||||
if append:
|
if append:
|
||||||
@@ -129,7 +131,10 @@ async def get_data(ip_list: list):
|
|||||||
|
|
||||||
async def get_formatted_data(ip: ipaddress.ip_address):
|
async def get_formatted_data(ip: ipaddress.ip_address):
|
||||||
miner = await miner_factory.get_miner(ip)
|
miner = await miner_factory.get_miner(ip)
|
||||||
data = await miner.api.multicommand("summary", "pools", "tunerstatus")
|
try:
|
||||||
|
data = await miner.api.multicommand("summary", "pools", "tunerstatus")
|
||||||
|
except APIError:
|
||||||
|
return {'TH/s': "Unknown", 'IP': str(miner.ip), 'host': "Unknown", 'user': "Unknown", 'wattage': 0}
|
||||||
host = await miner.get_hostname()
|
host = await miner.get_hostname()
|
||||||
if "tunerstatus" in data.keys():
|
if "tunerstatus" in data.keys():
|
||||||
wattage = await safe_parse_api_data(data, "tunerstatus", 0, 'TUNERSTATUS', 0, "PowerLimit")
|
wattage = await safe_parse_api_data(data, "tunerstatus", 0, 'TUNERSTATUS', 0, "PowerLimit")
|
||||||
|
|||||||
Reference in New Issue
Block a user