This commit is contained in:
PaulVua
2025-02-05 16:54:59 +01:00
parent 49be391eb3
commit 46303b9c19
9 changed files with 460 additions and 67 deletions

View File

@@ -15,19 +15,44 @@ import sqlite3
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
cursor = conn.cursor()
# Create a table for storing sensor data
# Create a table 1
cursor.execute("""
CREATE TABLE IF NOT EXISTS data (
CREATE TABLE IF NOT EXISTS data_NPM (
timestamp TEXT,
PM1 REAL,
PM25 REAL,
PM10 REAL,
temp REAL,
hum REAL,
press REAL,
temp_npm REAL,
hum_npm REAL
)
""")
# Create a table 2
cursor.execute("""
CREATE TABLE IF NOT EXISTS data_BME280 (
timestamp TEXT,
temperature REAL,
humidity REAL,
pressure REAL
)
""")
# Create a table 3
cursor.execute("""
CREATE TABLE IF NOT EXISTS data_envea (
timestamp TEXT,
no2 REAL,
h2s REAL,
o3 REAL,
nh3 REAL,
co REAL,
o3 REAL
)
""")
# Create a table 4
cursor.execute("""
CREATE TABLE IF NOT EXISTS data_NPM_5channels (
timestamp TEXT,
PM_ch1 INTEGER,
PM_ch2 INTEGER,
PM_ch3 INTEGER,
@@ -36,6 +61,8 @@ CREATE TABLE IF NOT EXISTS data (
)
""")
# Commit and close the connection
conn.commit()
conn.close()