public static function health() { $return = array(); $demon_state = self::deamonRunning(); $return[] = array('test' => __('Démon local', __FILE__), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $demon_state ? '' : __('Peut être normal si vous êtes en déporté', __FILE__), 'state' => $demon_state); $version = openzwave::getVersion('openzwave'); $return[] = array('test' => __('Version d\'openzwave', __FILE__), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<=')); $compilation = openzwave::compilationOk(); $return[] = array('test' => __('Compilation', __FILE__), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation); if (config::byKey('jeeNetwork::mode') == 'master') { $cron = cron::byClassAndFunction('openzwave', 'pull'); $running = false; if (is_object($cron)) { $running = $cron->running(); } $return[] = array('test' => __('Tâche Z-Wave', __FILE__), 'result' => $running ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $running ? '' : __('Allez sur la page du moteur des tâches et vérifiez lancer la tache openzwave::pull', __FILE__), 'state' => $running); foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) { try { $demon_state = $jeeNetwork->sendRawRequest('deamonRunning', array('plugin' => 'openzwave')); } catch (Exception $e) { $demon_state = false; } $return[] = array('test' => __('Démon sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => '', 'state' => $demon_state); $version = $jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')); $return[] = array('test' => __('Version d\'openzwave sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<=')); $compilation = $jeeNetwork->sendRawRequest('compilationOk', array('plugin' => 'openzwave')); $return[] = array('test' => __('Compilation sur', __FILE__) . $jeeNetwork->getName(), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation); } } return $return; }
echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;">OK</span></div>'; } echo '<label class="col-sm-1 control-label">{{Retour distant}}</label>'; if (!$urlMasterDistant) { echo '<div class="col-sm-1"><span class="label label-danger tooltips" style="font-size : 1em;" title="{{Vérifiez votre configuration sur la page de configuration réseaux, celle-ci est incorrecte et le démon ne pourra communiquer avec Jeedom}}">NOK</span></div>'; } else { echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;">OK</span></div>'; } echo '<label class="col-sm-2 control-label">{{OpenZwave}} (' . openzwave::getVersion('openzwave') . ')</label>'; if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) { echo '<div class="col-sm-1"><span class="label label-danger" style="font-size : 1em;">NOK</span></div>'; } else { echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;">OK</span></div>'; } echo '<label class="col-sm-1 control-label">{{Compilation}}</label>'; if (openzwave::compilationOk()) { echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;">OK</span></div>'; } else { echo '<div class="col-sm-1"><span class="label label-danger" style="font-size : 1em;">NOK</span></div>'; } echo '</div>'; echo '<div class="form-group">'; echo '<label class="col-sm-4 control-label">{{Démon local}}</label>'; if (!$deamonRunningMaster) { echo '<div class="col-sm-1"><span class="label label-danger tooltips" style="font-size : 1em;" title="{{Peut être normale si vous etes en deporté}}">NOK</span></div>'; } else { echo '<div class="col-sm-1"><span class="label label-success" style="font-size : 1em;">OK</span></div>'; } echo '</div>'; foreach ($deamonRunningSlave as $name => $status) { echo ' <div class="form-group"><label class="col-sm-4 control-label">{{Sur l\'esclave}} ' . $name . '</label>';
} $params = $jsonrpc->getParams(); if ($jsonrpc->getMethod() == 'deamonRunning') { $jsonrpc->makeSuccess(openzwave::deamonRunning()); } if ($jsonrpc->getMethod() == 'runDeamon') { 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'); $params['debug'] = !isset($params['debug']) ? 0 : $params['debug']; openzwave::runDeamon($params['debug']); $jsonrpc->makeSuccess('ok'); } if ($jsonrpc->getMethod() == 'stopDeamon') { config::save('allowStartDeamon', 0, 'openzwave'); $jsonrpc->makeSuccess(openzwave::stopDeamon()); } if ($jsonrpc->getMethod() == 'getVersion') { $jsonrpc->makeSuccess(openzwave::getVersion($params['module'])); } if ($jsonrpc->getMethod() == 'compilationOk') { $jsonrpc->makeSuccess(openzwave::compilationOk()); } throw new Exception(__('Aucune methode correspondante pour le plugin openzwave : ' . $jsonrpc->getMethod(), __FILE__));