Update dbus scripts (heartbit bug fixed)

This commit is contained in:
Noe 2024-06-27 16:48:02 +02:00
parent da24c43a7d
commit fd4610208d
2 changed files with 7 additions and 2 deletions

View File

@ -767,6 +767,7 @@ def update_state_from_dictionaries(current_warnings, current_alarms, node_number
description = list(current_warnings.keys())[i].split("/")[-1]
device_created = "Battery node " + list(current_warnings.keys())[i].split("/")[3]
status_message["Warnings"].append(AlarmOrWarning(description, device_created).to_dict())
if any(current_alarms.values()):
status_message["Status"]=2
@ -871,6 +872,7 @@ def update(modbus, batteries, dbus, signals, csv_signals):
current_alarms[signal_name] = value
#print(update_state_from_dictionaries(current_warnings, current_alarms))
status_message, alarms_number_list, warnings_number_list = update_state_from_dictionaries(current_warnings, current_alarms, node_numbers)
publish_values(dbus, signals, statuses)
create_csv_files(csv_signals, statuses, node_numbers, alarms_number_list, warnings_number_list)
logging.debug('finished update cycle\n')
@ -902,6 +904,8 @@ def count_files_in_folder(folder_path):
return str(e)
def create_batch_of_csv_files():
global prev_status
# list all files in the directory
files = os.listdir(CSV_DIR)
@ -981,7 +985,7 @@ def create_batch_of_csv_files():
status_message = {
"InstallationId": INSTALLATION_ID,
"Product": PRODUCT_ID,
"Status": 0,
"Status": prev_status,
"Type": 1,
"Warnings": [],
"Alarms": [],

View File

@ -580,6 +580,7 @@ def insert_id(path, id_number):
return "/".join(parts)
def create_batch_of_csv_files():
global prev_status
# list all files in the directory
files = os.listdir(CSV_DIR)
@ -662,7 +663,7 @@ def create_batch_of_csv_files():
status_message = {
"InstallationId": INSTALLATION_ID,
"Product": PRODUCT_ID,
"Status": 0,
"Status": prev_status,
"Type": 1,
"Warnings": [],
"Alarms": [],