Label = secop_module.target + simplified influx_name

This commit is contained in:
l_samenv
2024-08-19 09:11:19 +02:00
parent 474a855fad
commit 512e772aab
2 changed files with 9 additions and 5 deletions

View File

@@ -194,7 +194,7 @@ class InfluxDataGetter:
for setup_info_dict in all_setup_info_dict:
for (setup_info_variable_name, content) in setup_info_dict.items():
if content[0] != "nicos.devices.secop.devices.SecopDevice":
name = self._transform_setup_info_variable_name_to_influx(setup_info_variable_name)
name = self._transform_setup_info_variable_name_to_influx(content[1]["secop_module"])
if name not in added_names:
available_varirables.append(
{
@@ -207,17 +207,18 @@ class InfluxDataGetter:
added_names.append(name)
return available_varirables
def _transform_setup_info_variable_name_to_influx(self, setup_info_name):
def _transform_setup_info_variable_name_to_influx(self, secop_module_name):
"""
Transforms the name of the variable available in the setup_info dict into the Influx name.
Lowers the secop_module_name and adds "nicos/se_" as prefix
Parameters :
setup_info_name (str) : the name of the variable in the setup_info dict.
secop_module_name (str) : the secop module name of the variable in the setup_info dict.
Returns :
str : the transformed variable name that matches the Influx names reqauirements
"""
return self._influx_instrument_config["measurement_prefix"] + setup_info_name.lower()[len(self._influx_instrument_config["setup_info_prefix"]):]
return self._influx_instrument_config["measurement_prefix"] + secop_module_name.lower()
def _remove_variables_without_value_float(self, available_variables, times):
"""
@@ -309,7 +310,7 @@ class InfluxDataGetter:
return {
"name":variable["name"]+".target",
"label":variable["name"][len(self._influx_instrument_config["measurement_prefix"]):]+".target",
"label":variable["label"]+".target",
"unit":variable["unit"]
}

3
variables_config.ini Normal file
View File

@@ -0,0 +1,3 @@
[chart]
T_stat.raw=cat:rawOhm
T_stat=color:#FF0000