예제 #1
0
 require_once dirname(__FILE__) . '/../../core/php/core.inc.php';
 include_file('core', 'authentification', 'php');
 if (!isConnect()) {
     throw new Exception(__('401 - Accès non autorisé', __FILE__));
 }
 if (init('action') == 'getConf') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $plugin = plugin::byId(init('id'));
     $return = utils::o2a($plugin);
     $return['activate'] = $plugin->isActive();
     $return['configurationPath'] = $plugin->getPathToConfigurationById();
     $return['checkVersion'] = version_compare(jeedom::version(), $plugin->getRequire());
     $return['status'] = market::getInfo(array('logicalId' => $plugin->getId(), 'type' => 'plugin'));
     $return['update'] = utils::o2a(update::byLogicalId($plugin->getId()));
     ajax::success($return);
 }
 if (init('action') == 'toggle') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $plugin = plugin::byId(init('id'));
     if (!is_object($plugin)) {
         throw new Exception(__('Plugin introuvable : ', __FILE__) . init('id'));
     }
     $plugin->setIsEnable(init('state'));
     ajax::success();
 }
 if (init('action') == 'all') {
     if (!isConnect()) {
예제 #2
0
         $update->doUpdate();
         if ($update->getType() != 'core') {
             log::add('update', 'update', __("[END UPDATE SUCCESS]\n", __FILE__));
         }
     } catch (Exception $e) {
         if ($update->getType() != 'core') {
             log::add('update', 'update', $e->getMessage());
             log::add('update', 'update', __("[END UPDATE ERROR]\n", __FILE__));
         }
     }
     ajax::success();
 }
 if (init('action') == 'remove') {
     $update = update::byId(init('id'));
     if (!is_object($update)) {
         $update = update::byLogicalId(init('id'));
     }
     if (!is_object($update)) {
         throw new Exception(__('Aucune correspondance pour l\'ID : ' . init('id'), __FILE__));
     }
     $update->deleteObjet();
     ajax::success();
 }
 if (init('action') == 'updateAll') {
     update::makeUpdateLevel(init('mode'), init('level'), init('version', ''), init('onlyThisVersion', ''));
     ajax::success();
 }
 if (init('action') == 'changeState') {
     $update = update::byId(init('id'));
     if (!is_object($update)) {
         throw new Exception(__('Aucune correspondance pour l\'ID : ' . init('id'), __FILE__));
예제 #3
0
}
if (init('logicalId') != '' && init('type') != '') {
    $market = market::byLogicalIdAndType(init('logicalId'), init('type'));
}
if (!isset($market)) {
    throw new Exception('404 not found');
}
include_file('3rdparty', 'bootstrap.rating/bootstrap.rating', 'js');
include_file('3rdparty', 'slick/slick.min', 'js');
include_file('3rdparty', 'slick/slick', 'css');
include_file('3rdparty', 'slick/slick-theme', 'css');
include_file('3rdparty', 'fancybox/jquery.fancybox', 'js');
include_file('3rdparty', 'fancybox/jquery.fancybox', 'css');
$market_array = utils::o2a($market);
$market_array['rating'] = $market->getRating();
$update = update::byLogicalId($market->getLogicalId());
sendVarToJS('market_display_info', $market_array);
?>


<div class='row' style='background-color: #e7e7e7; padding-top: 10px; padding-bottom: 10px;position: relative; top: -10px;'>
    <div class='col-sm-3'>
        <center>
            <?php 
$default_image = 'core/img/no_image.gif';
switch ($market->getType()) {
    case 'widget':
        $default_image = 'core/img/no-image-widget.png';
        break;
    case 'plugin':
        $default_image = 'core/img/no-image-plugin.png';
예제 #4
0
 public static function syncEqLogicWithRazberry($_serverId = 1)
 {
     $results = self::callRazberry('/ZWaveAPI/Data/0', $_serverId);
     $findDevice = array();
     $include_device = '';
     $razberry_id = zwave::getZwaveInfo('controller::data::nodeId::value', $_serverId);
     $findConfiguration = true;
     foreach ($results['devices'] as $nodeId => $result) {
         $findDevice[$nodeId] = $nodeId;
         if ($nodeId != $razberry_id) {
             if (!is_object(self::getEqLogicByLogicalIdAndServerId($nodeId, $_serverId))) {
                 $eqLogic = new eqLogic();
                 $eqLogic->setEqType_name('zwave');
                 $eqLogic->setIsEnable(1);
                 $eqLogic->setName('Device ' . $nodeId);
                 $eqLogic->setLogicalId($nodeId);
                 $eqLogic->setConfiguration('serverID', $_serverId);
                 $eqLogic->setIsVisible(1);
                 $eqLogic->save();
                 $eqLogic = zwave::byId($eqLogic->getId());
                 $eqLogic->InterviewForce();
                 for ($i = 0; $i < 30; $i++) {
                     nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Pause de ', __FILE__) . (30 - $i) . __(' pour interview forcé du module', __FILE__)));
                     sleep(1);
                 }
                 $include_device = $eqLogic->getId();
                 $findConfiguration = false;
                 $result = self::callRazberry('/ZWaveAPI/Run/devices[' . $eqLogic->getLogicalId() . ']', $_serverId);
                 $data = $result['data'];
                 if (isset($data['manufacturerId']['value']) && isset($data['manufacturerProductType']['value']) && isset($data['manufacturerProductId']['value'])) {
                     nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Recherche, si nécessaire, de la configuration sur le market', __FILE__)));
                     sleep(1);
                     try {
                         $market_rpc = market::getJsonRpc();
                         if ($market_rpc->sendRequest('market::searchZwaveModuleConf', array('manufacturerId' => $data['manufacturerId']['value'], 'manufacturerProductType' => $data['manufacturerProductType']['value'], 'manufacturerProductId' => $data['manufacturerProductId']['value']))) {
                             foreach ($market_rpc->getResult() as $logicalId => $result) {
                                 if (isset($result['id'])) {
                                     $markets[$logicalId] = market::construct($result);
                                 }
                             }
                             if (count($markets) == 1) {
                                 $market = $markets[0];
                                 $update = update::byLogicalId($market->getLogicalId());
                                 if (!is_object($update)) {
                                     if ($market->getStatus('stable') == 1) {
                                         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en stable : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__)));
                                         sleep(1);
                                         $market->install();
                                     } else {
                                         if ($market->getStatus('beta') == 1) {
                                             nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en beta : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__)));
                                             sleep(1);
                                             $market->install('beta');
                                         }
                                     }
                                 }
                             }
                         }
                     } catch (Exception $e) {
                     }
                 }
                 /* Reconnaissance du module */
                 foreach (self::devicesParameters() as $device_id => $device) {
                     if ($device['manufacturerId'] == $data['manufacturerId']['value'] && $device['manufacturerProductType'] == $data['manufacturerProductType']['value'] && $device['manufacturerProductId'] == $data['manufacturerProductId']['value']) {
                         $findConfiguration = true;
                         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Périphérique reconnu : ', __FILE__) . $device['name'] . '!! (Manufacturer ID : ' . $data['manufacturerId']['value'] . ', Product type : ' . $data['manufacturerProductType']['value'] . ', Product ID : ' . $data['manufacturerProductId']['value'] . __('). Configuration en cours veuillez patienter...', __FILE__)));
                         sleep(1);
                         $eqLogic->setConfiguration('device', $device_id);
                         $eqLogic->save();
                         for ($i = 0; $i < 5; $i++) {
                             nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Pause de ', __FILE__) . (5 - $i) . __(' secondes pour synchronisation avec le module', __FILE__)));
                             sleep(1);
                         }
                         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Mise à jour forcée des valeurs des commandes', __FILE__)));
                         $listServerZway = self::listServerZway();
                         if ($listServerZway[$_serverId]['isOpenZwave'] != 1) {
                             $eqLogic->forceUpdate();
                         }
                         break;
                     }
                 }
             }
         }
     }
     if (config::byKey('autoRemoveExcludeDevice', 'zwave') == 1 && count($findDevice) > 1) {
         foreach (self::byType('zwave') as $eqLogic) {
             if (!isset($findDevice[$eqLogic->getLogicalId()]) && $eqLogic->getConfiguration('serverID') == $_serverId) {
                 $eqLogic->remove();
             }
         }
     }
     nodejs::pushUpdate('zwave::includeDevice', $include_device);
     if (!$findConfiguration) {
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Votre module n\'est pas reconnu, veuillez récupérer sa configuration sur le market si celle ci est disponible', __FILE__)));
     } else {
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => ''));
     }
 }