function arduidom_remove() { $cron = cron::byClassAndFunction('arduidom', 'checkdaemon'); if (is_object($cron)) { $cron->remove(); } arduidom::stopdaemon(1); arduidom::stopdaemon(2); arduidom::stopdaemon(3); arduidom::stopdaemon(4); arduidom::stopdaemon(5); arduidom::stopdaemon(6); arduidom::stopdaemon(7); arduidom::stopdaemon(8); }
* Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } //if (config::byKey('enableLogging', 'arduidom', 0) == 0) { // echo '<div class="alert alert-danger">{{Vous n\'avez pas activé l\'enregistrement de tous les messages : allez dans Générale -> Plugin puis rfxcom et coché la case correspondante}}</div>'; //} $_AID = init('arduid'); $daemonRunning = arduidom::checkdaemon($_AID); if ($daemonRunning != 1) { throw new Exception(__("Action Impossible : Le démon Arduidom " . $_AID . " ne fonctionne pas !", __FILE__)); } ?> <pre id='pre_ardulog' style='overflow: auto; height: 95%;width:90%;'></pre> <script> getArduLog(1); function getArduLog(_autoUpdate) { $.ajax({ type: 'POST',
echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_7">{{Démon <span class="badge">7</span><?php if (arduidom::checkdaemon(7) != 1) { echo ' (Offline)'; } ?> }}</a></li> <li<?php if (arduidom::checkdaemon(8) != 1) { echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_8">{{Démon <span class="badge">8</span><?php if (arduidom::checkdaemon(8) != 1) { echo ' (Offline)'; } ?> }}</a></li> </ul> <div class="tab-content"> <?php for ($i = 1; $i < 9; $i++) { ?> <div class="tab-pane<?php if ($i == 1) { echo " active"; } ?>
<li<?php if ($_AID == 1) { echo ' class="active"'; } if (arduidom::checkdaemon($_AID) != 1) { echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_<?php echo $_AID; ?> ">{{Arduino <?php echo '<span class="badge">' . $_AID . '</span>'; ?> <?php if (arduidom::checkdaemon($_AID) != 1) { echo ' (NOK)'; } ?> }}</a></li> <?php } ?> </ul>
if (init('action') == 'FullDebugEnable') { if (file_put_contents('/tmp/arduidom_debug_mode_on', "debugON") != false) { ajax::success(); } else { ajax::error("Une erreur est survenue pendant l'activation du mode Debug Arduidom ! (Problèmes de droits sur /tmp/arduidom_debug_mode_on ?)"); } } if (init('action') == 'FullDebugDisable') { if (unlink("/tmp/arduidom_debug_mode_on") == true) { ajax::success(); } else { ajax::error("Une erreur est survenue pendant la désactivation du mode Debug Arduidom ! (Problèmes de droits sur /tmp/arduidom_debug_mode_on ?)"); } } if (init('action') == 'MigrateArduidom') { if (arduidom::MigrateDatas() == 1) { ajax::success(); } else { ajax::error("Une erreur est survenue pendant la Migration des données Arduidom !"); } } if (init('action') == 'LearnRadio') { $text = ''; $etat = ''; cache::set('arduidom_radio_learn', 1); $RadioLastCode = cache::byKey('arduidom_radio_lastcode'); $RadioLastCode = $RadioLastCode->getValue(); $RadioRepeats = cache::byKey('arduidom_radio_index'); $RadioRepeats = $RadioRepeats->getValue(); $RadioLeanMode = cache::byKey('arduidom_radio_learn'); $RadioLeanMode = $RadioLeanMode->getValue();
* * Jeedom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } //if (config::byKey('enableLogging', 'arduidom', 0) == 0) { // echo '<div class="alert alert-danger">{{Vous n\'avez pas activé l\'enregistrement de tous les messages : allez dans Générale -> Plugin puis rfxcom et coché la case correspondante}}</div>'; //} if (arduidom::get_daemon_mode() != "OK") { if (substr(jeedom::version(), 0, 1) == 2) { event::add('jeedom::alert', array('level' => 'error', 'message' => __("Action Impossible : Le démon ne fonctionne pas !", __FILE__))); } } ?> <pre id='pre_ardulog' style='overflow: auto; height: 95%;width:90%;'></pre> <script> getArduLog(1); function getArduLog(_autoUpdate) { $.ajax({
?> "> <hr> <form class="form-horizontal"> <fieldset> <div class="form-group"> <label class="col-lg-3 control-label">Port Arduino</label> <div class="col-lg-9"> <select class="configKey form-control" data-l1key="A<?php echo $i; ?> _port"> <option value="none" id="arduinoportselect">Aucun</option> <?php echo '<optgroup label="Ports USB" />'; foreach (arduidom::getUsbArduinos() as $name => $value) { echo '<option value="' . $value . '">' . $name . ' (' . $value . ')</option>'; } echo '<optgroup label="Réseau" />'; echo '<option value="' . "Network" . '">' . "Arduino avec Shield Ethernet" . ' (' . "Network" . ')</option>'; echo '<optgroup label="Manuel (si non détecté)" />'; echo '<option value="' . "/dev/ttyUSB0" . '">' . "Arduino sur USB /dev/ttyUSB0" . ' (' . "/dev/ttyUSB0" . ')</option>'; echo '<option value="' . "/dev/ttyAMA0" . '">' . "Arduino sur port série GPIO Raspberry" . ' (' . "/dev/ttyAMA0" . ')</option>'; ?> </select> </div> </div> <div class="form-group"> <label class="col-lg-3 control-label">Modèle de l Arduino N° <?php echo $i; ?>
//if (init('arduid') == '') { // throw new Exception('{{L\'id de l\'arduino est requis : }}' . init('op_id')); //} //$_AID = init('arduid'); //$daemonRunning = arduidom::ping_arduino($_AID,false); //if ($daemonRunning != 1) { // throw new Exception(__("Action Impossible : Le démon Arduidom " . $_AID . " ne fonctionne pas !", __FILE__)); //} ?> <ul class="nav nav-pills" id="tab_arid"> <?php for ($_AID = 1; $_AID <= $ArduinoQty; $_AID++) { ?> <li<?php $DaemonOK = arduidom::ping_arduino($_AID, false, true); if ($_AID == 1) { echo ' class="active"'; } if ($DaemonOK != 1) { echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_<?php echo $_AID; ?> ">{{Arduino <?php echo '<span class="badge">' . $_AID . '</span>'; ?> <?php if ($DaemonOK != 1) {
public function execute($_options = null) { //file_put_contents("/tmp/arduidom2", time() . " : arduidom_execute" . "\n", FILE_APPEND); //$results = print_r($_options, true); //log::add('arduidom', 'debug', 'execute(' . $results . ') called'); //exec('echo "execute 2" >> /tmp/arduidom'); if ($this->getType() == 'action') { try { //exec('echo "execute 3" >> /tmp/arduidom'); //log::add('arduidom', 'debug', 'execute() called on type action'); //exec('echo "execute 4" >> /tmp/arduidom'); //log::add('arduidom','info','subTYPE=' . $this->getSubType()); $subType = $this->getSubType(); if ($subType == 'slider') { $value = str_replace('#slider#', $_options['slider'], $this->getConfiguration('value')); return arduidom::setPinValue($this->getLogicalId(), $value); } if ($subType == 'color') { $value = str_replace('#color#', $_options['color'], $this->getConfiguration('value')); return arduidom::setPinValue($this->getLogicalId(), $value); } if ($subType == 'other') { //GROS LAG RETIRE ICI - VERIFIER QUE CA N'A PAS D'INCIDENCE SUR LES FORMULES EN VALEURS// $value = $this->getConfiguration('value'); if ($value != 0 || $value != 1 || $value != "0" || $value != "1") { $value = jeedom::evaluateExpression($value); } return arduidom::setPinValue($this->getLogicalId(), $value); } } catch (Exception $e) { //exec('echo "execute 5" >> /tmp/arduidom'); //log::add('arduidom', 'debug', 'execute() ' . $e); return "bad"; } } /*if ($this->getType() == 'info') { try{ //exec('echo "execute 6" >> /tmp/arduidom'); //log::add('arduidom', 'debug', 'execute() called on type info'); return arduidom::getPinValue($this->getLogicalId()); } catch (Exception $e) { //exec('echo "execute 7" >> /tmp/arduidom'); //log::add('arduidom', 'debug', 'execute() ' . $e); return "bad"; } }*/ /* throw new Exception(__("Erreur: XXXXXXXXXXXXXXXXX", __FILE__)); log::add('arduidom', 'debug', 'foreach.....................'); foreach (eqLogic::byType('arduidom') as $eqLogic){ log::add('arduidom', 'debug', 'by type arduidom'); foreach ($eqLogic->getCmd('info') as $cmd) { log::add('arduidom', 'debug', 'getCmd info'); if (array_key_exists($cmd->getConfiguration('value'), $_GET)) { log::add('arduidom', 'debug', 'with value'); log::add('arduidom', 'debug', 'Mise à jour de : ' . $cmd->getConfiguration('value') . ':'. $_GET[$cmd->getConfiguration('value')]); $cmd->setValue($_GET[$cmd->getConfiguration('value')]); $cmd->event($_GET[$cmd->getConfiguration('value')]); $cmd->save(); } } log::add('arduidom', 'event', 'Mise à jour de ' . $eqLogic->getHumanName() . ' terminée'); } */ return "BAD"; }
?> }}</a></li> <li<?php $DaemonOK = arduidom::ping_arduino(7, false, true); if ($DaemonOK != 1) { echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_7">{{Démon <span class="badge">7</span><?php if ($DaemonOK != 1) { echo ' (Offline)'; } ?> }}</a></li> <li<?php $DaemonOK = arduidom::ping_arduino(8, false, true); if ($DaemonOK != 1) { echo ' class="disabled"'; } ?> ><a data-toggle="tab" href="#tab_8">{{Démon <span class="badge">8</span><?php if ($DaemonOK != 1) { echo ' (Offline)'; } ?> }}</a></li> </ul> <div class="tab-content"> <?php for ($i = 1; $i < 9; $i++) {