Beispiel #1
0
function openzwave_remove()
{
    if (openzwave::deamonRunning()) {
        openzwave::stopDeamon();
    }
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
 *
 * 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/>.
 */
require_once dirname(__FILE__) . '/../../../core/php/core.inc.php';
include_file('core', 'authentification', 'php');
if (!isConnect()) {
    include_file('desktop', '404', 'php');
    die;
}
$deamonRunningMaster = openzwave::deamonRunning();
$deamonRunningSlave = array();
$deamonSlaveVersion = array();
if (config::byKey('jeeNetwork::mode') == 'master') {
    foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
        $deamonSlaveVersion[$jeeNetwork->getName()] = array('openzwave' => 0, 'python-openzwave' => 0);
        $deamonRunningSlave[$jeeNetwork->getName()] = false;
        try {
            $deamonRunningSlave[$jeeNetwork->getName()] = $jeeNetwork->sendRawRequest('deamonRunning', array('plugin' => 'openzwave'));
            $deamonSlaveVersion[$jeeNetwork->getName()]['openzwave'] = $jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave'));
            $deamonSlaveVersion[$jeeNetwork->getName()]['compilation'] = $jeeNetwork->sendRawRequest('compilationOk', array('plugin' => 'openzwave'));
        } catch (Exception $e) {
        }
    }
}
$urlMasterLocal = false;
         $jeeNetwork = jeeNetwork::byId(init('id'));
         if (!is_object($jeeNetwork)) {
             throw new Exception(__('Impossible de trouver l\'esclave : ', __FILE__) . init('id'));
         }
         $jsonrpc = $jeeNetwork->getJsonRpc();
         if (!$jsonrpc->sendRequest('runDeamon', array('plugin' => 'openzwave', 'debug' => init('debug', 0)))) {
             throw new Exception($jsonrpc->getError(), $jsonrpc->getErrorCode());
         }
     } else {
         config::save('allowStartDeamon', 1, 'openzwave');
         $port = config::byKey('port', 'openzwave', 'none');
         if ($port == 'none') {
             ajax::success();
         }
         openzwave::stopDeamon();
         if (openzwave::deamonRunning()) {
             throw new Exception(__('Impossible d\'arrêter le démon', __FILE__));
         }
         log::clear('openzwave');
         openzwave::runDeamon(init('debug', 0));
     }
     ajax::success();
 }
 if (init('action') == 'rewriteNginxAndRestartCron') {
     openzwave::removeNginxRedirection();
     openzwave::listServerZwave();
     $cron = cron::byClassAndFunction('openzwave', 'pull');
     if (is_object($cron)) {
         $cron->stop();
     }
     ajax::success();
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * 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/>.
 */
require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
global $jsonrpc;
if (!is_object($jsonrpc)) {
    throw new Exception(__('JSONRPC object not defined', __FILE__), -32699);
}
$params = $jsonrpc->getParams();
if ($jsonrpc->getMethod() == 'deamonRunning') {
    $jsonrpc->makeSuccess(openzwave::deamonRunning());
}
if ($jsonrpc->getMethod() == 'getVersion') {
    $jsonrpc->makeSuccess(openzwave::getVersion($params['module']));
}
if ($jsonrpc->getMethod() == 'compilationOk') {
    $jsonrpc->makeSuccess(openzwave::compilationOk());
}
if ($jsonrpc->getMethod() == 'syncconfOpenzwave') {
    $jsonrpc->makeSuccess(openzwave::syncconfOpenzwave());
}
throw new Exception(__('Aucune methode correspondante pour le plugin openzwave : ' . $jsonrpc->getMethod(), __FILE__));