You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

110 lines
4.4 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOMOTOR</title>
<link rel="stylesheet" href="styles.css">
</head>
<?php
$etat_volet = "none";
exec('gpio mode 7 out');
exec('gpio mode 0 out');
exec('gpio mode 2 out');
exec('gpio mode 3 out');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_['ouvrir_volet'])) {
exec('gpio write 2 1');
sleep(1);
exec('gpio write 2 0');
$etat_volet = 'ouvert';
} elseif (isset($_['fermer_volet'])) {
exec('gpio write 3 1');
sleep(1);
exec('gpio write 3 0');
$etat_volet = 'fermé';
}
if (isset($_POST['lumiere'])) {
$lumiere = $_POST['lumiere'];
if ($lumiere == "Allumer") {
exec('gpio write 7 1');
} else {
exec('gpio write 7 0');
}
}
if (isset($_POST['radiateur'])) {
$chauffage = $_POST['radiateur'];
if ($chauffage == "Allumer") {
exec('gpio write 0 1');
} else {
exec('gpio write 0 0');
}
}
}
?>
<body>
<header>
<div class="header-content">
<h1>DOMOTOR</h1>
<p>Gestionnaire de domotique fiable et sécurisé</p>
</div>
</header>
<main id="main">
<div class="icon">
<img src="https://www.greenwatt.fr/wp-content/uploads/sites/94/2022/02/radiateur-basse-temperature.jpg" alt="Radiateur">
<div class="buttons">
<form method="post" action="">
<?php
exec('gpio read 0',$radiateur_est_allume);
$radiateur_est_allume = implode("", $radiateur_est_allume);
if ($radiateur_est_allume == 1) {
echo '<input type="submit" name="radiateur" value="Éteindre">';
} else {
echo '<input type="submit" name="radiateur" value="Allumer">';
}?>
</form>
</div>
</div>
<div class="icon">
<img src="https://www.voletshop.fr/52430-large_default/Volet-roulant-renovation-manuel.jpg" alt="Volet roulant">
<div class="buttons">
<form method="post" action="">
<?php
if ($etat_volet === "none") {
echo '<input type="submit" name="ouvrir_volet" value="oui" onclick="document.getElementById(\'chargement_fermeture_volet\').style.display = \'block\';document.getElementById(\'main\').style.opacity = \'0.5\';">';
echo '<input type="submit" name="fermer_volet" value="oui" onclick="document.getElementById(\'chargement_ouverture_volet\').style.display = \'block\';document.getElementById(\'main\').style.opacity = \'0.5\';">';
} elseif ($etat_volet === "ouvert") {
echo '<input type="submit" name="fermer_volet" value="oui" onclick="document.getElementById(\'chargement_ouverture_volet\').style.display = \'block\';document.getElementById(\'main\').style.opacity = \'0.5\';">';
} elseif ($etat_volet === "fermé") {
echo '<input type="submit" name="ouvrir_volet" value="oui" onclick="document.getElementById(\'chargement_fermeture_volet\').style.display = \'block\';document.getElementById(\'main\').style.opacity = \'0.5\';">';
}?>
</form>
</div>
</div>
<div class="icon">
<img src="https://www.pro-illumination.fr/img/p/1/5/6/2/1/15621.jpg" alt="Ampoule">
<div class="buttons">
<form method="post" action="">
<?php exec('gpio read 7',$rlumiere_est_allume);
$lumiere_est_allume = implode("", $rlumiere_est_allume);
if ($lumiere_est_allume == 1) {
echo '<input type="submit" name="lumiere" value="Éteindre">';
} else {
echo '<input type="submit" name="lumiere" value="Allumer">';
}?>
</form>
</div>
</div>
</main>
<div id="chargement_ouverture_volet" class="chargement">
<p>Ouverture en cours...</p>
</div>
<div id="chargement_fermeture_volet" class="chargement">
<p>Fermeture en cours...</p>
</div>
</body>
</html>