From 283879ae102227ec9bc31350f9b675c3523f9d48 Mon Sep 17 00:00:00 2001 From: Eduard Gerlitz Date: Fri, 5 Sep 2025 15:56:01 +0200 Subject: [PATCH] v1.0 HF4 --- app.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app.py b/app.py index bbeedc2..ca61a1c 100644 --- a/app.py +++ b/app.py @@ -125,13 +125,13 @@ def initialize_connection(): if OPCcon.check_connection() == 1: st.session_state.opcua_connector = OPCcon st.session_state.connection_status = "Connected" - add_log("🎉 Connection initialized successfully") + print("🎉 Connection initialized successfully") return True st.session_state.connection_status = "Disconnected" return False except Exception as e: - add_log(f"❌ Failed to initialize connection: {e}") + print(f"❌ Failed to initialize connection: {e}") st.session_state.connection_status = "Disconnected" return False @@ -139,10 +139,10 @@ def execute_button_action(button_name): """Execute button action with proper error handling""" if button_name == 'INIT': OPCcon.adapt_access_rights() - add_log(f"🔧 INIT button pressed - Access rights adapted") + print(f"🔧 INIT button pressed - Access rights adapted") else: OPCcon.press_btn(button_name) - add_log(f"🔘 {button_name} button pressed") + print(f"🔘 {button_name} button pressed") return True # Sidebar @@ -159,21 +159,17 @@ with st.sidebar: if st.button("🔌 Disconnect", use_container_width=True): if st.session_state.opcua_connector: try: - # Close InfluxDB connection - if hasattr(st.session_state.opcua_connector, 'influxclient'): - st.session_state.opcua_connector.influxclient.close() - add_log("📊 InfluxDB connection closed") # Disconnect OPC UA using the new method st.session_state.opcua_connector.disconnect() - add_log("🔌 Disconnected from OPC UA server") + print("🔌 Disconnected from OPC UA server") except Exception as e: - add_log(f"⚠️ Warning during disconnect: {e}") + print(f"⚠️ Warning during disconnect: {e}") st.session_state.opcua_connector = None st.session_state.connection_status = "Disconnected" - add_log("🔌 Connection reset") + print("🔌 Connection reset") st.rerun() st.divider()