MQTT Werkend gekregen

This commit is contained in:
Atilla
2024-03-10 22:21:01 +01:00
parent 78bf985a29
commit 6b8c3846c1
3 changed files with 118 additions and 0 deletions

16
mqtt/db_connect.py Normal file
View File

@@ -0,0 +1,16 @@
import mysql.connector
from mysql.connector import Error
def database_connect():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="goodgarden"
)
if connection.is_connected():
return connection
except Error as e:
print(f"Connection NIET gelukt! ${e}")
return None