From e75caff92938718a06540580198905e8faed66ce Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 26 Mar 2025 08:29:24 +0100 Subject: [PATCH] update --- SARA/reboot/start.py | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/SARA/reboot/start.py b/SARA/reboot/start.py index 7e909db..001d93f 100644 --- a/SARA/reboot/start.py +++ b/SARA/reboot/start.py @@ -18,6 +18,7 @@ import time import sys import json import re +import sqlite3 #GPIO SARA_power_GPIO = 16 @@ -25,7 +26,6 @@ SARA_ON_GPIO = 20 GPIO.setmode(GPIO.BCM) # Use BCM numbering GPIO.setup(SARA_power_GPIO, GPIO.OUT) # Set GPIO17 as an output -import sqlite3 # database connection conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db") @@ -64,36 +64,6 @@ def load_config_sqlite(): print(f"Error loading config from SQLite: {e}") return {} -#Fonction pour mettre à jour le JSON de configuration -def update_json_key(file_path, key, value): - """ - Updates a specific key in a JSON file with a new value. - - :param file_path: Path to the JSON file. - :param key: The key to update in the JSON file. - :param value: The new value to assign to the key. - """ - try: - # Load the existing data - with open(file_path, "r") as file: - data = json.load(file) - - # Check if the key exists in the JSON file - if key in data: - data[key] = value # Update the key with the new value - else: - print(f"Key '{key}' not found in the JSON file.") - return - - # Write the updated data back to the file - with open(file_path, "w") as file: - json.dump(data, file, indent=2) # Use indent for pretty printing - - print(f"💾 updating '{key}' to '{value}'.") - except Exception as e: - print(f"Error updating the JSON file: {e}") - - def update_sqlite_config(key, value): """ Updates a specific key in the SQLite config_table with a new value.