This commit is contained in:
PaulVua
2025-05-23 14:30:18 +02:00
parent 2516a3bd1c
commit 5a0f1c0745
7 changed files with 19 additions and 174 deletions

View File

@@ -200,30 +200,6 @@ def load_config_sqlite():
print(f"Error loading config from SQLite: {e}")
return {}
def load_config_scripts_sqlite():
"""
Load script configuration data from SQLite config_scripts_table
Returns:
dict: Script paths as keys and enabled status as boolean values
"""
try:
# Query the config_scripts_table
cursor.execute("SELECT script_path, enabled FROM config_scripts_table")
rows = cursor.fetchall()
# Create config dictionary with script paths as keys and enabled status as boolean values
scripts_config = {}
for script_path, enabled in rows:
# Convert integer enabled value (0/1) to boolean
scripts_config[script_path] = bool(enabled)
return scripts_config
except Exception as e:
print(f"Error loading scripts config from SQLite: {e}")
return {}
#Load config
config = load_config_sqlite()
#config
@@ -234,16 +210,13 @@ device_latitude_raw = config.get('latitude_raw', 0)
device_longitude_raw = config.get('longitude_raw', 0)
modem_version=config.get('modem_version', "")
Sara_baudrate = config.get('SaraR4_baudrate', 115200)
npm_5channel = config.get('npm_5channel', False) #5 canaux du NPM
selected_networkID = int(config.get('SARA_R4_neworkID', 0))
send_uSpot = config.get('send_uSpot', False) #envoi sur MicroSpot ()
npm_5channel = config.get('npm_5channel', False) #5 canaux du NPM
envea_cairsens= config.get('envea', False)
wind_meter= config.get('windMeter', False)
#config_scripts
config_scripts = load_config_scripts_sqlite()
bme_280_config = config_scripts.get('BME280/get_data_v2.py', False)
envea_cairsens= config_scripts.get('envea/read_value_v2.py', False)
mppt_charger= config_scripts.get('MPPT/read.py', False)
bme_280_config = config.get('BME280', False)
mppt_charger= config.get('MPPT', False)
#update device id in the payload json
payload_json["nebuleairid"] = device_id