Arbitrary number of config files + tag is unit or cat if present + unit keyword + empty string in config file means inherit + unit 1 is not given or empty

This commit is contained in:
l_samenv
2024-09-03 11:02:50 +02:00
parent 9eb0d4d97d
commit a73fe1653e
7 changed files with 58 additions and 35 deletions

View File

@ -28,9 +28,9 @@ class InfluxGraph:
ACTUAL = 1
LIVE = 2
def __init__(self, influx_data_getter):
def __init__(self, influx_data_getter, instrument):
self.influx_data_getter = influx_data_getter
self.chart_config = ChartConfig("./variables_config.ini")
self.chart_configs = [ChartConfig("./config/generic.ini"), ChartConfig(f"./config/{instrument}.ini")]
self.livemode = self.HISTORICAL
self.end_query = 0
self.lastvalues = {}
@ -131,7 +131,7 @@ class InfluxGraph:
start_time = int(self.get_abs_time(time)[0])
end_time = int(self.get_abs_time(time)[-1])
blocks = self.influx_data_getter.get_available_variables_at_time([start_time, end_time], self.chart_config)
blocks = self.influx_data_getter.get_available_variables_at_time([start_time, end_time], self.chart_configs)
device_name = self.influx_data_getter.get_device_name(end_time)
# updates the self.variables attribute to keep track of the available variables
self.variables = {variable["name"]:variable["label"] for block in blocks for variable in block["curves"]}