chore: sync local changes

This commit is contained in:
2026-02-19 22:22:27 +01:00
parent 563f11eb28
commit 5193580d13
4 changed files with 6 additions and 21 deletions

5
app.py
View File

@@ -10,7 +10,7 @@ def database_connect():
connection = mysql.connector.connect( connection = mysql.connector.connect(
host="localhost", host="localhost",
user="root", user="root",
password="", password="root",
database="goodgarden" database="goodgarden"
) )
return connection return connection
@@ -18,10 +18,12 @@ def database_connect():
except Exception as e: except Exception as e:
print("Database connection failed:", e) print("Database connection failed:", e)
#Throw error
return None return None
# Function to get data from the MySQL database # Function to get data from the MySQL database
def get_database_data(): def get_database_data():
#Throw error
mydb = database_connect() mydb = database_connect()
if mydb and mydb.is_connected(): if mydb and mydb.is_connected():
@@ -45,6 +47,7 @@ def get_data():
return jsonify(battery_data) # Directly return the list of dictionaries as JSON return jsonify(battery_data) # Directly return the list of dictionaries as JSON
def get_weather_data(): def get_weather_data():
# Api key in a file
api_key = "05ddd06644" api_key = "05ddd06644"
location = "Leiden" location = "Leiden"
url = f"https://weerlive.nl/api/weerlive_api_v2.php?key={api_key}&locatie={location}" url = f"https://weerlive.nl/api/weerlive_api_v2.php?key={api_key}&locatie={location}"

View File

@@ -5,7 +5,7 @@
"scripts": { "scripts": {
"start": "npm-run-all --parallel start-flask start-electron", "start": "npm-run-all --parallel start-flask start-electron",
"start-electron": "wait-on http://localhost:5000 && electron app.js", "start-electron": "wait-on http://localhost:5000 && electron app.js",
"start-flask": "python app.py" "start-flask": "py app.py"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",

View File

@@ -10,7 +10,7 @@ def database_connect():
connection = mysql.connector.connect( connection = mysql.connector.connect(
host="localhost", # De hostnaam waar de database draait, in dit geval lokaal. host="localhost", # De hostnaam waar de database draait, in dit geval lokaal.
user="root", # De gebruikersnaam voor de database. user="root", # De gebruikersnaam voor de database.
password="", # Het wachtwoord voor de gebruiker, leeg in dit geval. password="root", # Het wachtwoord voor de gebruiker, leeg in dit geval.
database="goodgarden" # De naam van de database waarmee je wilt verbinden. database="goodgarden" # De naam van de database waarmee je wilt verbinden.
) )
# Controleer of de verbinding succesvol is opgezet. # Controleer of de verbinding succesvol is opgezet.

View File

@@ -4,23 +4,5 @@
"plant_naam": "Tomatenplant", "plant_naam": "Tomatenplant",
"plantensoort": "Groente", "plantensoort": "Groente",
"plant_geteelt": 1 "plant_geteelt": 1
},
{
"id": 15,
"plant_naam": "ergerg",
"plantensoort": "ergerwgergerg",
"plant_geteelt": 1
},
{
"id": 16,
"plant_naam": "sdfsf",
"plantensoort": "ewfewfwf",
"plant_geteelt": 1
},
{
"id": 17,
"plant_naam": "34t3t34t34t",
"plantensoort": "343245345345",
"plant_geteelt": 1
} }
] ]