Conflit readme règlé
This commit is contained in:
20
domo91.py
20
domo91.py
@@ -8,6 +8,7 @@ import matplotlib.dates as mdates
|
|||||||
from fpdf import FPDF
|
from fpdf import FPDF
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import datetime
|
||||||
|
|
||||||
st.set_page_config(page_title="Domo91 - Surveillance", layout="wide")
|
st.set_page_config(page_title="Domo91 - Surveillance", layout="wide")
|
||||||
st.title("📡 Supervision Températures")
|
st.title("📡 Supervision Températures")
|
||||||
@@ -19,6 +20,8 @@ db_config = {
|
|||||||
"password": "#SO2&1nf%mZ@jfh",
|
"password": "#SO2&1nf%mZ@jfh",
|
||||||
"database": "Sondes"
|
"database": "Sondes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# --- Fonction de génération PDF ---
|
# --- Fonction de génération PDF ---
|
||||||
def generer_pdf(site, date_str):
|
def generer_pdf(site, date_str):
|
||||||
st.info(f"Génération du rapport PDF pour {site} à la date {date_str}")
|
st.info(f"Génération du rapport PDF pour {site} à la date {date_str}")
|
||||||
@@ -105,6 +108,23 @@ if "authenticated" not in st.session_state:
|
|||||||
|
|
||||||
# --- Sidebar (connexion + bouton PDF) ---
|
# --- Sidebar (connexion + bouton PDF) ---
|
||||||
with st.sidebar:
|
with st.sidebar:
|
||||||
|
if st.sidebar.button("🔔 Forcer une alerte de test"):
|
||||||
|
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
sonde_test = "TEST_ALERTE"
|
||||||
|
try:
|
||||||
|
conn = mysql.connector.connect(**db_params)
|
||||||
|
cursor = conn.cursor()
|
||||||
|
table_alertes = f"Alertes_{site}"
|
||||||
|
cursor.execute(f"""
|
||||||
|
INSERT INTO {table_alertes} (Sonde, Debut_defaut, Etat)
|
||||||
|
VALUES (%s, %s, %s)
|
||||||
|
""", (sonde_test, now, "Test"))
|
||||||
|
conn.commit()
|
||||||
|
cursor.close()
|
||||||
|
conn.close()
|
||||||
|
st.success(f"Alerte de test créée pour {sonde_test} à {now}")
|
||||||
|
except Exception as e:
|
||||||
|
st.error(f"Erreur lors de la création de l'alerte : {e}")
|
||||||
st.header("🔐 Connexion")
|
st.header("🔐 Connexion")
|
||||||
if not st.session_state.get("authenticated"):
|
if not st.session_state.get("authenticated"):
|
||||||
login = st.text_input("Nom d'utilisateur")
|
login = st.text_input("Nom d'utilisateur")
|
||||||
|
|||||||
Reference in New Issue
Block a user