diff --git a/Program/__pycache__/database.cpython-311.pyc b/Program/__pycache__/database.cpython-311.pyc index 58aa4c6..ea1a347 100644 Binary files a/Program/__pycache__/database.cpython-311.pyc and b/Program/__pycache__/database.cpython-311.pyc differ diff --git a/Program/__pycache__/mail.cpython-311.pyc b/Program/__pycache__/mail.cpython-311.pyc index d55802b..8028207 100644 Binary files a/Program/__pycache__/mail.cpython-311.pyc and b/Program/__pycache__/mail.cpython-311.pyc differ diff --git a/Program/database.py b/Program/database.py index 6950b1f..5b7067f 100644 --- a/Program/database.py +++ b/Program/database.py @@ -1,5 +1,7 @@ +from datetime import datetime import sqlite3 from os import path +import time from env import SENSORS, DBFILE @@ -34,11 +36,12 @@ def create_database(db_name): # Check if the database file exists def check_database(db_name): if not path.exists(db_name): - print(f"Database '{db_name}' not found. Creating...") + + print(f"[{datetime.now()}] Database '{db_name}' not found. Creating...") create_database(db_name) - print("Database and tables created successfully.") + print(f"[{datetime.now()}] Database and tables created successfully.") else: - print(f"Database '{db_name}' found.") + print(f"[{datetime.now()}] Database '{db_name}' found.") # Function to add data to SensorData table diff --git a/Program/datascraper.py b/Program/datascraper.py index 65a6614..48d5024 100644 --- a/Program/datascraper.py +++ b/Program/datascraper.py @@ -1,3 +1,4 @@ +from datetime import datetime from mail import * import schedule import threading @@ -35,7 +36,8 @@ def BltDataScrap(): return 0 def RunInThread_DataScrap(): - print("######################################################################\nOpen Thread datascrap") + now = datetime.now() + print(f"######################################################################\n[{now}] Open Thread datascrap") threading.Thread(target=BltDataScrap, daemon=True).start() def ScheduleDataScrap(): diff --git a/Program/mail.py b/Program/mail.py index 690db63..5bf1020 100644 --- a/Program/mail.py +++ b/Program/mail.py @@ -1,8 +1,10 @@ +from datetime import datetime from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import sqlite3 import threading + import schedule from env import * @@ -88,7 +90,8 @@ def check_and_send_email(): conn.close() def RunInThread_MailAlerts(): - print("######################################################################\nOpen Thread mail check Alert") + now = datetime.now() + print(f"######################################################################\n[{now}] Open Thread mail check Alert") threading.Thread(target=check_and_send_email, daemon=True).start() def ScheduleMailAlerts(): diff --git a/Program/templates/index.html b/Program/templates/index.html index 60b7bbd..039be6d 100644 --- a/Program/templates/index.html +++ b/Program/templates/index.html @@ -71,9 +71,9 @@