updates
This commit is contained in:
parent
d1e4ca8b97
commit
e95d8117d6
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
|||||||
|
from datetime import datetime
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from os import path
|
from os import path
|
||||||
|
import time
|
||||||
|
|
||||||
from env import SENSORS, DBFILE
|
from env import SENSORS, DBFILE
|
||||||
|
|
||||||
@ -34,11 +36,12 @@ def create_database(db_name):
|
|||||||
# Check if the database file exists
|
# Check if the database file exists
|
||||||
def check_database(db_name):
|
def check_database(db_name):
|
||||||
if not path.exists(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)
|
create_database(db_name)
|
||||||
print("Database and tables created successfully.")
|
print(f"[{datetime.now()}] Database and tables created successfully.")
|
||||||
else:
|
else:
|
||||||
print(f"Database '{db_name}' found.")
|
print(f"[{datetime.now()}] Database '{db_name}' found.")
|
||||||
|
|
||||||
|
|
||||||
# Function to add data to SensorData table
|
# Function to add data to SensorData table
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from datetime import datetime
|
||||||
from mail import *
|
from mail import *
|
||||||
import schedule
|
import schedule
|
||||||
import threading
|
import threading
|
||||||
@ -35,7 +36,8 @@ def BltDataScrap():
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
def RunInThread_DataScrap():
|
def RunInThread_DataScrap():
|
||||||
print("######################################################################\nOpen Thread datascrap")
|
now = datetime.now()
|
||||||
|
print(f"######################################################################\n[{now}] Open Thread datascrap")
|
||||||
threading.Thread(target=BltDataScrap, daemon=True).start()
|
threading.Thread(target=BltDataScrap, daemon=True).start()
|
||||||
|
|
||||||
def ScheduleDataScrap():
|
def ScheduleDataScrap():
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
|
from datetime import datetime
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
import schedule
|
import schedule
|
||||||
from env import *
|
from env import *
|
||||||
|
|
||||||
@ -88,7 +90,8 @@ def check_and_send_email():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def RunInThread_MailAlerts():
|
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()
|
threading.Thread(target=check_and_send_email, daemon=True).start()
|
||||||
|
|
||||||
def ScheduleMailAlerts():
|
def ScheduleMailAlerts():
|
||||||
|
|||||||
@ -71,9 +71,9 @@
|
|||||||
<td>{{ row[0] }}</td>
|
<td>{{ row[0] }}</td>
|
||||||
<td>{{ row[1] }}</td>
|
<td>{{ row[1] }}</td>
|
||||||
<td>{{ row[2] }}</td>
|
<td>{{ row[2] }}</td>
|
||||||
<td>{{ row[3] }}</td>
|
<td>{{ row[3] }}°C</td>
|
||||||
<td>{{ row[4] }}</td>
|
<td>{{ row[4] }}%</td>
|
||||||
<td>{{ row[5] }}</td>
|
<td>{{ row[5] }}%</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user