diff --git a/front/php/components/graph_online_history.php b/front/php/components/graph_online_history.php index 2010c3d8..cc600976 100755 --- a/front/php/components/graph_online_history.php +++ b/front/php/components/graph_online_history.php @@ -7,8 +7,18 @@ ?> - \ No newline at end of file diff --git a/server/api.py b/server/api.py index 1d9543bd..9191bba1 100755 --- a/server/api.py +++ b/server/api.py @@ -9,6 +9,7 @@ from const import (apiPath, sql_appevents, sql_devices_all, sql_events_pending_a from logger import mylog from helper import write_file, get_setting_value, updateState, timeNowTZ from execution_log import ExecutionLog +from notification import write_notification # Import the start_server function from graphql_server.graphql_server_start import start_server @@ -127,6 +128,7 @@ class api_endpoint_class: # Needs to be called for initial updates self.try_write() + #---------------------------------------- def try_write(self): current_time = timeNowTZ() @@ -144,7 +146,7 @@ class api_endpoint_class: if self.is_ad_hoc_user_event: execution_log = ExecutionLog() execution_log.finalize_event("update_api") - write_notification(f"[Ad-hoc events] Events executed: update_api", "interrupt", timeNowTZ()) + self.is_ad_hoc_user_event = False else: # Debugging if write is skipped diff --git a/server/plugin.py b/server/plugin.py index bd6d765b..1fc9d3ac 100755 --- a/server/plugin.py +++ b/server/plugin.py @@ -861,26 +861,23 @@ def check_and_run_user_event(db, all_plugins, pluginsState): event, param = "", "" if len(columns) == 2: event, param = columns - - try: - # Process each event type - if event == 'test': - pluginsState = handle_test(param, db, all_plugins, pluginsState) - executed_events.append(f"test with param {param}") - execution_log.finalize_event("test") - elif event == 'run': - pluginsState = handle_run(param, db, all_plugins, pluginsState) - executed_events.append(f"run with param {param}") - execution_log.finalize_event("run") - elif event == 'update_api': - # async handling - update_api(db, all_plugins, False, param.split(','), True) - - else: - mylog('minimal', ['[check_and_run_user_event] WARNING: Unhandled event in execution queue: ', event, ' | ', param]) - execution_log.finalize_event(event) # Finalize unknown events to remove them - except Exception as e: - mylog('none', ['[check_and_run_user_event] ERROR: Error processing event "', event, '" with param "', param, '": ', str(e)]) + + # Process each event type + if event == 'test': + pluginsState = handle_test(param, db, all_plugins, pluginsState) + executed_events.append(f"test with param {param}") + execution_log.finalize_event("test") + elif event == 'run': + pluginsState = handle_run(param, db, all_plugins, pluginsState) + executed_events.append(f"run with param {param}") + execution_log.finalize_event("run") + elif event == 'update_api': + # async handling + update_api(db, all_plugins, False, param.split(','), True) + + else: + mylog('minimal', ['[check_and_run_user_event] WARNING: Unhandled event in execution queue: ', event, ' | ', param]) + execution_log.finalize_event(event) # Finalize unknown events to remove them # Notify user about executed events (if applicable) if len(executed_events) > 0 and executed_events: