update
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
'''
|
||||
____ ___ _ _ _
|
||||
/ ___| / _ \| | (_) |_ ___
|
||||
\___ \| | | | | | | __/ _ \
|
||||
___) | |_| | |___| | || __/
|
||||
|____/ \__\_\_____|_|\__\___|
|
||||
|
||||
Script to write data to a sqlite database
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/sqlite/write.py
|
||||
|
||||
@@ -12,14 +18,13 @@ cursor = conn.cursor()
|
||||
|
||||
# Insert a sample temperature reading
|
||||
timestamp = "2025-10-11"
|
||||
sensor_name = "NebuleAir-pro020"
|
||||
PM1 = 25.3
|
||||
PM25 = 18.3
|
||||
PM10 = 9.3
|
||||
|
||||
cursor.execute('''
|
||||
INSERT INTO data (timestamp, sensor_id, PM1, PM25, PM10) VALUES (?,?,?,?,?)'''
|
||||
, (timestamp, sensor_name,PM1,PM25,PM10))
|
||||
INSERT INTO data (timestamp, PM1, PM25, PM10) VALUES (?,?,?,?,?)'''
|
||||
, (timestamp,PM1,PM25,PM10))
|
||||
|
||||
# Commit and close the connection
|
||||
conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user