Update dbus scripts (heartbit bug fixed)
This commit is contained in:
parent
da24c43a7d
commit
fd4610208d
|
@ -768,6 +768,7 @@ def update_state_from_dictionaries(current_warnings, current_alarms, node_number
|
||||||
device_created = "Battery node " + list(current_warnings.keys())[i].split("/")[3]
|
device_created = "Battery node " + list(current_warnings.keys())[i].split("/")[3]
|
||||||
status_message["Warnings"].append(AlarmOrWarning(description, device_created).to_dict())
|
status_message["Warnings"].append(AlarmOrWarning(description, device_created).to_dict())
|
||||||
|
|
||||||
|
|
||||||
if any(current_alarms.values()):
|
if any(current_alarms.values()):
|
||||||
status_message["Status"]=2
|
status_message["Status"]=2
|
||||||
|
|
||||||
|
@ -871,6 +872,7 @@ def update(modbus, batteries, dbus, signals, csv_signals):
|
||||||
current_alarms[signal_name] = value
|
current_alarms[signal_name] = value
|
||||||
#print(update_state_from_dictionaries(current_warnings, current_alarms))
|
#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)
|
status_message, alarms_number_list, warnings_number_list = update_state_from_dictionaries(current_warnings, current_alarms, node_numbers)
|
||||||
|
|
||||||
publish_values(dbus, signals, statuses)
|
publish_values(dbus, signals, statuses)
|
||||||
create_csv_files(csv_signals, statuses, node_numbers, alarms_number_list, warnings_number_list)
|
create_csv_files(csv_signals, statuses, node_numbers, alarms_number_list, warnings_number_list)
|
||||||
logging.debug('finished update cycle\n')
|
logging.debug('finished update cycle\n')
|
||||||
|
@ -902,6 +904,8 @@ def count_files_in_folder(folder_path):
|
||||||
return str(e)
|
return str(e)
|
||||||
|
|
||||||
def create_batch_of_csv_files():
|
def create_batch_of_csv_files():
|
||||||
|
|
||||||
|
global prev_status
|
||||||
# list all files in the directory
|
# list all files in the directory
|
||||||
files = os.listdir(CSV_DIR)
|
files = os.listdir(CSV_DIR)
|
||||||
|
|
||||||
|
@ -981,7 +985,7 @@ def create_batch_of_csv_files():
|
||||||
status_message = {
|
status_message = {
|
||||||
"InstallationId": INSTALLATION_ID,
|
"InstallationId": INSTALLATION_ID,
|
||||||
"Product": PRODUCT_ID,
|
"Product": PRODUCT_ID,
|
||||||
"Status": 0,
|
"Status": prev_status,
|
||||||
"Type": 1,
|
"Type": 1,
|
||||||
"Warnings": [],
|
"Warnings": [],
|
||||||
"Alarms": [],
|
"Alarms": [],
|
||||||
|
|
|
@ -580,6 +580,7 @@ def insert_id(path, id_number):
|
||||||
return "/".join(parts)
|
return "/".join(parts)
|
||||||
|
|
||||||
def create_batch_of_csv_files():
|
def create_batch_of_csv_files():
|
||||||
|
global prev_status
|
||||||
# list all files in the directory
|
# list all files in the directory
|
||||||
files = os.listdir(CSV_DIR)
|
files = os.listdir(CSV_DIR)
|
||||||
|
|
||||||
|
@ -662,7 +663,7 @@ def create_batch_of_csv_files():
|
||||||
status_message = {
|
status_message = {
|
||||||
"InstallationId": INSTALLATION_ID,
|
"InstallationId": INSTALLATION_ID,
|
||||||
"Product": PRODUCT_ID,
|
"Product": PRODUCT_ID,
|
||||||
"Status": 0,
|
"Status": prev_status,
|
||||||
"Type": 1,
|
"Type": 1,
|
||||||
"Warnings": [],
|
"Warnings": [],
|
||||||
"Alarms": [],
|
"Alarms": [],
|
||||||
|
|
Loading…
Reference in New Issue