$tags['#DEBUG#'] = 1; $scenario->setTags($tags); $tags = $scenario->getTags(); $DEBUG = $tags['#DEBUG#']; if($DEBUG) { $scenario->setLog('[DEBUG] : DEBUT'); } /* TON SCRIPT */ $tags = $scenario->getTags(); $DEBUG = $tags['#DEBUG#']; // Le script crée le fichier MesData.json avec les infos de l'équipement $file_MesData='/var/www/html/plugins/script/data/MON-EQUIPEMENT/MesData.json'; $etat_porte=""; $niveau_oxygene=""; $heures=""; $minutes=""; $secondes=""; $horotage=""; // test si le fichier MesData.json existe if(file_exists($file_MesData)) { $scenario->setLog(' [INFO] : MAJ des infos MON-EQUIPEMENT'); // on met le contenu des infos du fichier MesData.json dans une variable $data = file_get_contents($file_MesData); $resultat_data = json_decode($data); // recupere les infos du fichier $etat_porte=$resultat_data->{'doorOpen'}; $niveau_oxygene=$resultat_data->{'oxygen_level'}; $heures=$resultat_data->{'hours'}; $minutes=$resultat_data->{'minutes'}; $secondes=$resultat_data->{'seconds'}; // fabrique l'heure du message $horotage=$heures . ":" . $minutes . ":" . $secondes; if($DEBUG) { $scenario->setLog(' [DEBUG] : $horodatage=' . $horodatage); $scenario->setLog(' [DEBUG] : $etat_porte=' . $etat_porte); $scenario->setLog(' [DEBUG] : $niveau_oxygene=' . $niveau_oxygene); } // supprime le fichier MesData.json unlink($file_MesData); } // on enregistre les infos de la connexion internet dans les variables Jeedom $scenario->setData('$horodatage', $horodatage); $scenario->setData('etat_porte', $etat_porte); $scenario->setData('niveau_oxygene', $niveau_oxygene); if($DEBUG) { $scenario->setLog('[DEBUG] : FIN'); };