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"; }