updates
This commit is contained in:
@@ -27,14 +27,6 @@ CREATE TABLE IF NOT EXISTS config_table (
|
||||
)
|
||||
""")
|
||||
|
||||
#creates a config_scripts table
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS config_scripts_table (
|
||||
script_path TEXT PRIMARY KEY,
|
||||
enabled INTEGER NOT NULL
|
||||
)
|
||||
''')
|
||||
|
||||
#creates a config table for envea sondes
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS envea_sondes_table (
|
||||
@@ -46,7 +38,6 @@ CREATE TABLE IF NOT EXISTS envea_sondes_table (
|
||||
)
|
||||
""")
|
||||
|
||||
|
||||
# Create a table timer
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS timestamp_table (
|
||||
|
||||
@@ -22,35 +22,14 @@ print(f"Connected to database")
|
||||
|
||||
# Clear existing data (if any)
|
||||
cursor.execute("DELETE FROM config_table")
|
||||
cursor.execute("DELETE FROM config_scripts_table")
|
||||
cursor.execute("DELETE FROM envea_sondes_table")
|
||||
print("Existing data cleared")
|
||||
|
||||
#add values
|
||||
|
||||
# Insert script configurations
|
||||
script_configs = [
|
||||
("NPM/get_data_modbus_v3.py", True),
|
||||
("loop/SARA_send_data_v2.py", True),
|
||||
("RTC/save_to_db.py", True),
|
||||
("BME280/get_data_v2.py", True),
|
||||
("envea/read_value_v2.py", False),
|
||||
("MPPT/read.py", False),
|
||||
("windMeter/read.py", False),
|
||||
("sqlite/flush_old_data.py", True)
|
||||
]
|
||||
|
||||
for script_path, enabled in script_configs:
|
||||
cursor.execute(
|
||||
"INSERT INTO config_scripts_table (script_path, enabled) VALUES (?, ?)",
|
||||
(script_path, 1 if enabled else 0)
|
||||
)
|
||||
|
||||
# Insert general configurations
|
||||
config_entries = [
|
||||
("modem_config_mode", "0", "bool"),
|
||||
("deviceID", "XXXX", "str"),
|
||||
("npm_5channel", "0", "bool"),
|
||||
("latitude_raw", "0", "int"),
|
||||
("longitude_raw", "0", "int"),
|
||||
("latitude_precision", "0", "int"),
|
||||
@@ -65,7 +44,11 @@ config_entries = [
|
||||
("SARA_R4_neworkID", "20810", "int"),
|
||||
("WIFI_status", "connected", "str"),
|
||||
("send_uSpot", "0", "bool"),
|
||||
("npm_5channel", "0", "bool"),
|
||||
("envea", "0", "bool"),
|
||||
("windMeter", "0", "bool"),
|
||||
("BME280", "0", "bool"),
|
||||
("MPPT", "0", "bool"),
|
||||
("modem_version", "XXX", "str")
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user