Beispiel #1
0
 public function cron30($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('karotz');
     }
     foreach ($eqLogics as $karotz) {
         if ($karotz->getIsEnable() == 1) {
             $request = 'http://' . $karotz->getConfiguration('addr') . '/cgi-bin/status';
             $request = new com_http($request);
             $jsonstatus = json_decode($request->exec(5, 1), true);
             $change = false;
             foreach ($karotz->getCmd() as $cmd) {
                 if (!isset($jsonstatus[$cmd->getLogicalId()])) {
                     continue;
                 }
                 $value = $jsonstatus[$cmd->getLogicalId()];
                 if ($cmd->getLogicalId() == 'led_color') {
                     $value = '#' . $value;
                 }
                 if ($cmd->execCmd() !== $cmd->formatValue($value)) {
                     $cmd->event($value);
                     $change = true;
                 }
             }
             if ($change) {
                 $karotz->refreshWidget();
             }
         }
     }
 }
 public static function pull($_options)
 {
     $date = time();
     log::add('mySensors', 'info', 'Cron de vérification des nodes');
     foreach (eqLogic::byType('mySensors') as $elogic) {
         log::add('mySensors', 'info', 'Vérification du node' . $elogic->getName());
         if ($elogic->getConfiguration('followActivity') == '1') {
             log::add('mySensors', 'info', $elogic->getName() . ' en surveillance');
             $actDate = $elogic->getConfiguration('LastActivity');
             log::add('mySensors', 'info', 'Derniere Activite ' . $actDate);
             $activity = strtotime($actDate);
             $duration = $elogic->getConfiguration('AlertLimit');
             log::add('mySensors', 'info', 'Interval paramétré ' . $duration);
             $interval = round(abs($date - $activity) / 60, 2);
             log::add('mySensors', 'info', 'Durée d inactivité ' . $interval);
             if ($interval > $duration) {
                 log::add('mySensors', 'info', 'Délai dépassé pour ' . $elogic->getName());
                 $gate = self::byLogicalId('gateway', 'mySensors');
                 $value = $elogic->getName();
                 $cmdlogic = mySensorsCmd::byEqLogicIdAndLogicalId($gate->getId(), 'Inactif');
                 $cmdlogic->setConfiguration('value', $value);
                 $cmdlogic->save();
                 $cmdlogic->event($value);
             }
         }
     }
 }
Beispiel #3
0
function openzwave_update()
{
    if (openzwave::deamonRunning()) {
        echo 'Stop zwave network...';
        openzwave::stopDeamon();
        echo "OK\n";
    }
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('openzwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setDeamonSleepTime(0.5);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    config::save('allowStartDeamon', 0, 'openzwave');
                    openzwave::updateOpenzwave(false);
                    config::save('allowStartDeamon', 1, 'openzwave');
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
}
 public static function cronHourly($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('porkfolio');
     }
     foreach ($eqLogics as $porkfolio) {
         if ($porkfolio->getIsEnable() == 1) {
             log::add('porkfolio', 'debug', 'Pull Cron pour Porkfolio');
             $porkfolioInfo = $porkfolio->getporkfolioInfo();
             $somme = isset($porkfolioInfo['Somme']) ? $porkfolioInfo['Somme'] : "old";
             $derniervers = isset($porkfolioInfo['Dernier']) ? $porkfolioInfo['Dernier'] : "old";
             $datemvt = isset($porkfolioInfo['Date Mouvement']) ? $porkfolioInfo['Date Mouvement'] : "old";
             $dateretournement = isset($porkfolioInfo['Date Retournement']) ? $porkfolioInfo['Date Retournement'] : "old";
             $datevers = isset($porkfolioInfo['Date depot']) ? $porkfolioInfo['Date depot'] : "old";
             $objectif = isset($porkfolioInfo['Objectif']) ? $porkfolioInfo['Objectif'] : "old";
             $nez = isset($porkfolioInfo['Nez']) ? $porkfolioInfo['Nez'] : "old";
             foreach ($porkfolio->getCmd('info') as $cmd) {
                 switch ($cmd->getName()) {
                     case 'Somme':
                         $value = $somme;
                         break;
                     case 'Dernière Opération':
                         $value = $derniervers;
                         break;
                     case 'Date mouvement':
                         $value = $datemvt;
                         break;
                     case 'Date dépot':
                         $value = $datevers;
                         break;
                     case 'Nez':
                         $value = $nez;
                         break;
                     case 'Date retournement':
                         $value = $dateretournement;
                         break;
                     case 'Objectif':
                         $value = $objectif;
                         break;
                 }
                 if ($value == 0 || $value != 'old') {
                     $cmd->event($value);
                     log::add('porkfolio', 'debug', 'set:' . $cmd->getName() . ' to ' . $value);
                 }
             }
             $mc = cache::byKey('porkfolioWidgetmobile' . $porkfolio->getId());
             $mc->remove();
             $mc = cache::byKey('porkfolioWidgetdashboard' . $porkfolio->getId());
             $mc->remove();
             $porkfolio->toHtml('mobile');
             $porkfolio->toHtml('dashboard');
             $porkfolio->refreshWidget();
         }
     }
 }
Beispiel #5
0
function openzwave_update()
{
    log::add('openzwave', 'error', __('Après toute installation/mise à jour pensez bien à mettre à jour les dépendances Openzwave (voir documentation)', __FILE__));
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
    }
    shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
    shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
    shell_exec('rm -rf /opt/python-openzwave/xml_backups');
    shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
    config::save('allowStartDeamon', 0, 'openzwave');
    echo 'Stop zwave network...';
    openzwave::stop();
    openzwave::stopDeamon();
    echo "OK\n";
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    openzwave::updateOpenzwave(false);
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
    echo 'Redemarrage zwave network...';
    try {
        config::save('allowStartDeamon', 1, 'openzwave');
        openzwave::runDeamon();
    } catch (Exception $e) {
    }
    echo "OK\n";
}
Beispiel #6
0
function karotz_update()
{
    foreach (eqLogic::byType('karotz') as $karotz) {
        foreach ($karotz->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $karotz->save();
    }
}
Beispiel #7
0
function nabaztag_update()
{
    foreach (eqLogic::byType('nabaztag') as $nabaztag) {
        foreach ($nabaztag->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $nabaztag->save();
    }
}
 public static function getDisplayIds($pebbleId)
 {
     $displayIds = '';
     foreach (eqLogic::byType('jebble') as $jebble) {
         if ($jebble->getIsEnable() && $jebble->getId() == $pebbleId) {
             $displayIds = $jebble->getConfiguration('display_ids');
             log::add('jebble', 'debug', 'ids:' . $displayIds);
             break;
         }
     }
     return $displayIds;
 }
 public static function cron30($_eqlogic_id = null)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('wazeintime');
         sleep(rand(0, 120));
     }
     foreach ($eqLogics as $wazeintime) {
         if ($wazeintime->getIsEnable() == 1) {
             try {
                 $start = $wazeintime->getPosition('start');
                 $end = $wazeintime->getPosition('end');
                 $row = $wazeintime->getConfiguration('NOA') ? '' : 'row-';
                 $wazeRouteurl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&to=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At';
                 $request_http = new com_http($wazeRouteurl);
                 $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0');
                 $json = json_decode($request_http->exec(6, 2), true);
                 if (isset($json['error'])) {
                     throw new Exception($json['error']);
                 }
                 $data = self::extractInfo($json);
                 $wazeRoutereturl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&to=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At';
                 $request_http = new com_http($wazeRoutereturl);
                 $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0');
                 $json = json_decode($request_http->exec(6, 2), true);
                 if (isset($json['error'])) {
                     throw new Exception($json['error']);
                 }
                 $data = array_merge($data, self::extractInfo($json, 'ret'));
                 log::add('wazeintime', 'debug', 'Data : ' . print_r($data, true));
                 foreach ($wazeintime->getCmd('info') as $cmd) {
                     if ($cmd->getLogicalId() == 'lastrefresh') {
                         $cmd->event(date('H:i'));
                         continue;
                     }
                     if (!isset($data[$cmd->getLogicalId()])) {
                         continue;
                     }
                     if ($cmd->formatValue($data[$cmd->getLogicalId()]) != $cmd->execCmd()) {
                         $cmd->setCollectDate('');
                         $cmd->event($data[$cmd->getLogicalId()]);
                     }
                 }
                 $wazeintime->refreshWidget();
             } catch (Exception $e) {
                 log::add('wazeintime', 'error', $e->getMessage());
             }
         }
     }
 }
Beispiel #10
0
 public static function cron($_eqlogic_id = null, $force = false)
 {
     if ($_eqlogic_id !== null) {
         $eqLogics = array(eqLogic::byId($_eqlogic_id));
     } else {
         $eqLogics = eqLogic::byType('trains');
     }
     foreach ($eqLogics as $trains) {
         if ($trains->getIsEnable() == 1) {
             if ($force || date('Hi', time()) >= $trains->getConfiguration('trains_maj_deb') && date('Hi', time()) <= $trains->getConfiguration('trains_maj_fin')) {
                 log::add('trains', 'debug', 'Pull ' . ($force ? 'Forcé' : 'Cron') . ' pour trains ');
                 $baseUrl = 'http://www.gares-sncf.com/fr/train-times/departure/' . $trains->getConfiguration('trains_depart') . '/gl';
                 $arrivee = $trains->getConfiguration('trains_arrivee');
                 $response = file_get_contents($baseUrl);
                 $json = json_decode($response, true);
                 $departs = [];
                 foreach ($json['trains'] as $depart) {
                     $trainCourant = (object) [];
                     if ($arrivee == '' || $trains->string_contains($depart['origdest'], $arrivee)) {
                         $trainCourant->dest = $depart['origdest'];
                         $trainCourant->type = $depart['type'];
                         $trainCourant->voie = $depart['voie'];
                         $trainCourant->heure = $depart['heure'];
                         $trainCourant->etat = $depart['etat'];
                         $trainCourant->retard = $depart['retard'];
                         $trainCourant->infos = $depart['infos'];
                         $departs[] = $trainCourant;
                     }
                 }
                 log::add('trains', 'debug', 'Date de mise à jour des infos récupérées : ' . $json['updated']);
                 log::add('trains', 'debug', 'infos récupérées : ' . json_encode($departs));
                 $result = (object) [];
                 $result->updated = $json['updated'];
                 $result->departs = $departs;
                 $trainsCmd = $trains->getCmd(null, 'Departs');
                 if (is_object($trainsCmd)) {
                     $trainsCmd->event(json_encode($result));
                 }
                 $trains->refreshWidget();
             }
         }
     }
 }
Beispiel #11
0
function openzwave_update()
{
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
        if (file_exists('/opt/python-openzwave/xml_backups')) {
            shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
            shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
            shell_exec('rm -rf /opt/python-openzwave/xml_backups');
            shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
        }
    }
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    openzwave::syncconfOpenzwave();
}
Beispiel #12
0
function ecodevice_remove()
{
    $cron = cron::byClassAndFunction('ecodevice', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    $cron = cron::byClassAndFunction('ecodevice', 'cron');
    if (is_object($cron)) {
        $cron->remove();
    }
    foreach (eqLogic::byType('ecodevice_compteur') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice_teleinfo') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice') as $eqLogic) {
        $eqLogic->remove();
    }
}
 public function copyFromEqLogic($_eqLogic_id)
 {
     $eqLogic = eqLogic::byId($_eqLogic_id);
     if (!is_object($eqLogic)) {
         throw new Exception(__('Impossible de trouver l\'équipement : ', __FILE__) . $_eqLogic_id);
     }
     if ($eqLogic->getEqType_name() == 'virtual') {
         throw new Exception(__('Vous ne pouvez importer la configuration d\'un équipement virtuel', __FILE__));
     }
     foreach ($eqLogic->getCategory() as $key => $value) {
         $this->setCategory($key, $value);
     }
     foreach ($eqLogic->getCmd() as $cmd_def) {
         $cmd = new virtualCmd();
         $cmd->setName($cmd_def->getName());
         $cmd->setEqLogic_id($this->getId());
         $cmd->setIsVisible($cmd_def->getIsVisible());
         $cmd->setType($cmd_def->getType());
         $cmd->setUnite($cmd_def->getUnite());
         $cmd->setOrder($cmd_def->getOrder());
         $cmd->setDisplay('icon', $cmd_def->getDisplay('icon'));
         $cmd->setDisplay('invertBinary', $cmd_def->getDisplay('invertBinary'));
         foreach ($cmd_def->getTemplate() as $key => $value) {
             $cmd->setTemplate($key, $value);
         }
         $cmd->setSubType($cmd_def->getSubType());
         if ($cmd->getType() == 'info') {
             $cmd->setConfiguration('calcul', '#' . $cmd_def->getId() . '#');
             $cmd->setValue($cmd_def->getId());
             $cmd->setEventOnly(1);
         } else {
             $cmd->setValue($cmd_def->getValue());
             $cmd->setConfiguration('infoName', '#' . $cmd_def->getId() . '#');
         }
         $cmd->save();
     }
     $this->save();
 }
Beispiel #14
0
 public function setIsEnable($_state)
 {
     if (version_compare(jeedom::version(), $this->getRequire()) == -1 && $_state == 1) {
         throw new Exception('Votre version de jeedom n\'est pas assez récente pour activer ce plugin');
     }
     $alreadyActive = config::byKey('active', $this->getId(), 0);
     if ($_state == 1) {
         if (config::byKey('jeeNetwork::mode') != 'master' && $this->getAllowRemote() != 1) {
             throw new Exception('Vous ne pouvez pas activer ce plugin sur un Jeedom configuré en esclave');
         }
         //market::checkPayment($this->getId());
         config::save('active', $_state, $this->getId());
     }
     if ($_state == 0) {
         $eqLogics = eqLogic::byType($this->getId());
         if (is_array($eqLogics)) {
             foreach ($eqLogics as $eqLogic) {
                 try {
                     $eqLogic->setConfiguration('previousIsEnable', $eqLogic->getIsEnable());
                     $eqLogic->setConfiguration('previousIsVisible', $eqLogic->getIsVisible());
                     $eqLogic->setIsEnable(0);
                     $eqLogic->setIsVisible(0);
                     $eqLogic->save();
                 } catch (Exception $e) {
                 }
             }
         }
         $listeners = listener::byClass($this->getId());
         if (is_array($listeners)) {
             foreach ($listeners as $listener) {
                 $listener->remove();
             }
         }
     }
     if ($alreadyActive == 0 && $_state == 1) {
         foreach (eqLogic::byType($this->getId()) as $eqLogic) {
             try {
                 $eqLogic->setIsEnable($eqLogic->getConfiguration('previousIsEnable', 1));
                 $eqLogic->setIsVisible($eqLogic->getConfiguration('previousIsVisible', 1));
                 $eqLogic->save();
             } catch (Exception $e) {
             }
         }
     }
     try {
         if ($_state == 1) {
             if ($alreadyActive == 1) {
                 $out = $this->callInstallFunction('update');
             } else {
                 $out = $this->callInstallFunction('install');
             }
         } else {
             if ($alreadyActive == 1) {
                 $out = $this->callInstallFunction('remove');
             }
         }
         if (isset($out) && trim($out) != '') {
             log::add($this->getId(), 'info', "Installation/remove/update result : " . $out);
         }
     } catch (Exception $e) {
         config::save('active', $alreadyActive, $this->getId());
         log::add('plugin', 'error', $e->getMessage());
         throw $e;
     }
     if ($_state == 0) {
         config::save('active', $_state, $this->getId());
     }
     return true;
 }
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
sendVarToJS('eqType', '#plugin_id#');
$eqLogics = eqLogic::byType('#plugin_id#');
?>

<div class="row row-overflow">
    <div class="col-lg-2 col-md-3 col-sm-4">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add">
                    <i class="fa fa-plus-circle"></i> {{Ajouter un #plugin_name#}}
                </a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
            </ul>
            <ul id="ul_eqLogicView" class="nav nav-pills nav-stacked"></ul> <!-- la sidebar -->
        </div>
    </div>

    <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
        <legend>{{Mes #plugin_name#}}</legend> <!-- changer pour votre type d'équipement -->

        <div class="eqLogicThumbnailContainer"></div> <!-- le container -->
    </div>

    <!-- Affichage de l'eqLogic sélectionné -->
    <div class="col-lg-10 col-md-9 col-sm-8 eqLogic" style="border-left: solid 1px #EEE; padding-left: 25px;display: none;">
        <form class="form-horizontal">
Beispiel #16
0
    }
    if (init('action') == 'syncEqLogicWithTeslaSite') {
        tesla::syncEqLogicWithTeslaSite();
        ajax::success();
    }
    if (init('action') == 'createToken') {
        $result = tesla::createToken(init('email'), init('password'));
        //config::save('token',$result,'tesla');
        ajax::success($result);
    }
    if (init('action') == 'checkAPI') {
        ajax::success(tesla::checkAPI());
    }
    // action qui permet d'obtenir l'ensemble des eqLogic
    if (init('action') == 'getAll') {
        $eqLogics = eqLogic::byType('tesla');
        // ne pas oublier de modifier pour le nom de votre plugin
        // la liste des équipements
        foreach ($eqLogics as $eqLogic) {
            $data['id'] = $eqLogic->getId();
            $data['humanSidebar'] = $eqLogic->getHumanName(true, false);
            $data['humanContainer'] = $eqLogic->getHumanName(true, true);
            $return[] = $data;
        }
        ajax::success($return);
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
				<div class="col-lg-3">
					<input type="checkbox" class="configKey bootstrapSwitch" data-l1key="auto_health" />
				</div>
			</div>
			<legend><i class="fa fa-cog"></i>  {{Gestion avancée}}</legend>
			<div class="form-group">
				<label class="col-lg-4 control-label">{{Options avancées}}</label>
				<div class="col-lg-5">
					<a class="btn btn-success" id="bt_consoleZwave"><i class="fa fa-terminal"></i> {{Console}}</a>
					<a class="btn btn-warning" id="bt_backupsZwave"><i class="fa fa-floppy-o"></i> {{Backups}}</a>
					<a class="btn btn-danger" id="bt_fileconfigZwave"><i class="fa fa-file-o"></i> {{Configuration}}</a>
				</div>
			</div>
			<?php 
}
if (config::byKey('jeeNetwork::mode') == 'master' && count(eqLogic::byType('zwave')) > 0) {
    ?>
			<div class="form-group">
				<label class="col-lg-4 control-label">{{Migration des équipements zwave}}</label>
				<div class="col-lg-3">
					<a class="btn btn-warning" id="bt_migrateZwave"><i class="fa fa-ship"></i> {{Migrer}}</a>
				</div>
			</div>
			<?php 
}
?>
		</fieldset>
	</form>
	<form class="form-horizontal">
		<fieldset>
			<legend><i class="icon loisir-darth"></i>  {{Démon local}}</legend>
Beispiel #18
0
 public function getEqLogic()
 {
     if ($this->_eqLogic == null) {
         $this->_eqLogic = eqLogic::byId($this->eqLogic_id);
     }
     return $this->_eqLogic;
 }
Beispiel #19
0
    throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
$type = init('type');
switch ($type) {
    case 'cmdHistory':
        $cmd = cmd::byId(init('id'));
        if (!is_object($cmd)) {
            throw new Exception(__('Commande introuvable : ', __FILE__) . init('id'));
        }
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=' . str_replace(' ', '_', $cmd->getHumanName()) . '.csv');
        $histories = $cmd->getHistory();
        foreach ($histories as $history) {
            echo $history->getDatetime();
            echo ';';
            echo str_replace('.', ',', $history->getValue());
            echo "\n";
        }
        break;
    case 'eqLogic':
        $eqLogic = eqLogic::byId(init('id'));
        if (!is_object($eqLogic)) {
            throw new Exception(__('Commande introuvable : ', __FILE__) . init('id'));
        }
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=' . $eqLogic->getHumanName() . '.json');
        echo json_encode($eqLogic->export(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
        break;
    default:
        break;
}
 public function execute(&$scenario = null)
 {
     if ($this->getOptions('enable', 1) == 0) {
         return;
     }
     $message = '';
     try {
         if ($this->getType() == 'element') {
             $element = scenarioElement::byId($this->getExpression());
             if (is_object($element)) {
                 $this->setLog($scenario, __('Exécution d\'un bloc élément : ', __FILE__) . $this->getExpression());
                 return $element->execute($scenario);
             }
             return;
         }
         $options = $this->getOptions();
         if (isset($options['enable'])) {
             unset($options['enable']);
         }
         if (is_array($options) && $this->getExpression() != 'wait') {
             foreach ($options as $key => $value) {
                 $options[$key] = str_replace('"', '', self::setTags($value, $scenario));
             }
         }
         if ($this->getType() == 'action') {
             if ($this->getExpression() == 'icon') {
                 if ($scenario != null) {
                     $options = $this->getOptions();
                     $this->setLog($scenario, __('Changement de l\'icone du scénario : ', __FILE__) . $options['icon']);
                     $scenario->setDisplay('icon', $options['icon']);
                     $scenario->save();
                 }
                 return;
             } else {
                 if ($this->getExpression() == 'wait') {
                     if (!isset($options['condition'])) {
                         return;
                     }
                     $result = false;
                     $occurence = 0;
                     $limit = isset($options['timeout']) && is_numeric($options['timeout']) ? $options['timeout'] : 7200;
                     while ($result !== true) {
                         $expression = self::setTags($options['condition'], $scenario);
                         $result = evaluate($expression);
                         if ($occurence > $limit) {
                             $this->setLog($scenario, __('[Wait] Condition valide par dépassement de temps', __FILE__));
                             return;
                         }
                         $occurence++;
                         sleep(1);
                     }
                     $this->setLog($scenario, __('[Wait] Condition valide : ', __FILE__) . $expression);
                     return;
                 } else {
                     if ($this->getExpression() == 'sleep') {
                         if (isset($options['duration'])) {
                             try {
                                 $options['duration'] = evaluate($options['duration']);
                             } catch (Exception $e) {
                             }
                             if (is_numeric($options['duration']) && $options['duration'] > 0) {
                                 $this->setLog($scenario, __('Pause de ', __FILE__) . $options['duration'] . __(' seconde(s)', __FILE__));
                                 if ($options['duration'] < 1) {
                                     return usleep($options['duration'] * 1000);
                                 } else {
                                     return sleep($options['duration']);
                                 }
                             }
                         }
                         $this->setLog($scenario, __('Aucune durée trouvée pour l\'action sleep ou la durée n\'est pas valide : ', __FILE__) . $options['duration']);
                         return;
                     } else {
                         if ($this->getExpression() == 'stop') {
                             if ($scenario != null) {
                                 $this->setLog($scenario, __('Arret du scénario', __FILE__));
                                 $scenario->setState('stop');
                                 $scenario->setPID('');
                                 $scenario->persistLog();
                                 $scenario->save();
                             }
                             die;
                         } else {
                             if ($this->getExpression() == 'log') {
                                 if ($scenario != null) {
                                     $scenario->setLog('Log : ' . $options['message']);
                                     if ($scenario->getConfiguration('speedPriority', 0) == 1) {
                                         $scenario->persistLog();
                                     }
                                 }
                                 return;
                             } else {
                                 if ($this->getExpression() == 'message') {
                                     message::add('scenario', $options['message']);
                                     return;
                                 } else {
                                     if ($this->getExpression() == 'equipement') {
                                         $eqLogic = eqLogic::byId(str_replace(array('#eqLogic', '#'), '', $this->getOptions('eqLogic')));
                                         if (!is_object($eqLogic)) {
                                             throw new Exception(__('Action sur l\'équipement impossible. Equipement introuvable - Vérifiez l\'id : ', __FILE__) . $this->getOptions('eqLogic'));
                                         }
                                         switch ($this->getOptions('action')) {
                                             case 'show':
                                                 $this->setLog($scenario, __('Equipement visible : ', __FILE__) . $eqLogic->getHumanName());
                                                 $eqLogic->setIsVisible(1);
                                                 $eqLogic->save();
                                                 break;
                                             case 'hide':
                                                 $this->setLog($scenario, __('Equipement masqué : ', __FILE__) . $eqLogic->getHumanName());
                                                 $eqLogic->setIsVisible(0);
                                                 $eqLogic->save();
                                                 break;
                                             case 'deactivate':
                                                 $this->setLog($scenario, __('Equipement désactivé : ', __FILE__) . $eqLogic->getHumanName());
                                                 $eqLogic->setIsEnable(0);
                                                 $eqLogic->save();
                                                 break;
                                             case 'activate':
                                                 $this->setLog($scenario, __('Equipement activé : ', __FILE__) . $eqLogic->getHumanName());
                                                 $eqLogic->setIsEnable(1);
                                                 $eqLogic->save();
                                                 break;
                                         }
                                         return;
                                     } else {
                                         if ($this->getExpression() == 'say') {
                                             $this->setLog($scenario, __('Je dis : ', __FILE__) . $options['message']);
                                             nodejs::pushUpdate('jeedom::say', $options['message']);
                                             return;
                                         } else {
                                             if ($this->getExpression() == 'gotodesign') {
                                                 $this->setLog($scenario, __('Changement design : ', __FILE__) . $options['plan_id']);
                                                 nodejs::pushUpdate('jeedom::gotoplan', $options['plan_id']);
                                                 return;
                                             } else {
                                                 if ($this->getExpression() == 'return') {
                                                     $this->setLog($scenario, __('Je vais retourner : ', __FILE__) . $options['message']);
                                                     $scenario->setReturn($scenario->getReturn() . $options['message']);
                                                     return;
                                                 } else {
                                                     if ($this->getExpression() == 'scenario') {
                                                         if ($scenario != null && $this->getOptions('scenario_id') == $scenario->getId()) {
                                                             $actionScenario =& $scenario;
                                                         } else {
                                                             $actionScenario = scenario::byId($this->getOptions('scenario_id'));
                                                         }
                                                         if (!is_object($actionScenario)) {
                                                             throw new Exception($scenario, __('Action sur scénario impossible. Scénario introuvable - Vérifiez l\'id : ', __FILE__) . $this->getOptions('scenario_id'));
                                                         }
                                                         switch ($this->getOptions('action')) {
                                                             case 'start':
                                                                 $this->setLog($scenario, __('Lancement du scénario : ', __FILE__) . $actionScenario->getName());
                                                                 if ($scenario != null) {
                                                                     $actionScenario->launch(false, __('Lancement provoqué par le scénario  : ', __FILE__) . $scenario->getHumanName());
                                                                 } else {
                                                                     $actionScenario->launch(false, __('Lancement provoqué', __FILE__));
                                                                 }
                                                                 break;
                                                             case 'stop':
                                                                 $this->setLog($scenario, __('Arrêt forcé du scénario : ', __FILE__) . $actionScenario->getName());
                                                                 $actionScenario->stop();
                                                                 break;
                                                             case 'deactivate':
                                                                 $this->setLog($scenario, __('Désactivation du scénario : ', __FILE__) . $actionScenario->getName());
                                                                 $actionScenario->setIsActive(0);
                                                                 $actionScenario->save();
                                                                 break;
                                                             case 'activate':
                                                                 $this->setLog($scenario, __('Activation du scénario : ', __FILE__) . $actionScenario->getName());
                                                                 $actionScenario->setIsActive(1);
                                                                 $actionScenario->save();
                                                                 break;
                                                         }
                                                         return;
                                                     } else {
                                                         if ($this->getExpression() == 'variable') {
                                                             $options['value'] = self::setTags($options['value']);
                                                             try {
                                                                 $result = evaluate($options['value']);
                                                                 if (!is_numeric($result)) {
                                                                     $result = $options['value'];
                                                                 }
                                                             } catch (Exception $ex) {
                                                                 $result = $options['value'];
                                                             }
                                                             $message = __('Affectation de la variable ', __FILE__) . $this->getOptions('name') . __(' => ', __FILE__) . $options['value'] . ' = ' . $result;
                                                             $this->setLog($scenario, $message);
                                                             $dataStore = new dataStore();
                                                             $dataStore->setType('scenario');
                                                             $dataStore->setKey($this->getOptions('name'));
                                                             $dataStore->setValue($result);
                                                             $dataStore->setLink_id(-1);
                                                             $dataStore->save();
                                                             return;
                                                         } else {
                                                             $cmd = cmd::byId(str_replace('#', '', $this->getExpression()));
                                                             if (is_object($cmd)) {
                                                                 if ($cmd->getSubtype() == 'slider' && isset($options['slider'])) {
                                                                     $options['slider'] = evaluate($options['slider']);
                                                                 }
                                                                 if (is_array($options) && count($options) != 0) {
                                                                     $this->setLog($scenario, __('Exécution de la commande ', __FILE__) . $cmd->getHumanName() . __(" avec comme option(s) : \n", __FILE__) . print_r($options, true));
                                                                 } else {
                                                                     $this->setLog($scenario, __('Exécution de la commande ', __FILE__) . $cmd->getHumanName());
                                                                 }
                                                                 if (is_object($scenario) && $scenario->getConfiguration('cmdNoWait', 0) == 1) {
                                                                     $options['speedAndNoErrorReport'] = true;
                                                                 }
                                                                 return $cmd->execCmd($options);
                                                             }
                                                             $this->setLog($scenario, __('[Erreur] Aucune commande trouvée pour ', __FILE__) . $this->getExpression());
                                                             return;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             if ($this->getType() == 'condition') {
                 $expression = self::setTags($this->getExpression(), $scenario, true);
                 $message = __('Evaluation de la condition : [', __FILE__) . $expression . '] = ';
                 $result = evaluate($expression);
                 if (is_bool($result)) {
                     if ($result) {
                         $message .= __('Vrai', __FILE__);
                     } else {
                         $message .= __('Faux', __FILE__);
                     }
                 } else {
                     $message .= $result;
                 }
                 $this->setLog($scenario, $message);
                 return $result;
             } else {
                 if ($this->getType() == 'code') {
                     $this->setLog($scenario, __('Exécution d\'un bloc code', __FILE__));
                     return eval($this->getExpression());
                 }
             }
         }
     } catch (Exception $e) {
         $this->setLog($scenario, $message . $e->getMessage());
     }
 }
 public static function syncEqLogicWithOpenZwave($_serverId = 0, $_logical_id = null)
 {
     try {
         $controlerState = self::callOpenzwave('/ZWaveAPI/Run/network.GetControllerStatus()', $_serverId);
         $state = $controlerState['result']['data']['networkstate']['value'];
     } catch (Exception $e) {
         $state = 10;
     }
     if ($state < 7) {
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Le controleur est occupé veuillez réessayer plus tard', __FILE__)));
         return;
     }
     if ($_logical_id !== null) {
         $eqLogic = self::getEqLogicByLogicalIdAndServerId($_logical_id, $_serverId);
         if (is_object($eqLogic)) {
             if (config::byKey('autoRemoveExcludeDevice', 'openzwave') == 1) {
                 $eqLogic->remove();
                 nodejs::pushUpdate('zwave::includeDevice', '');
             }
             nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => ''));
             return;
         }
         $result = self::callOpenzwave('/ZWaveAPI/Run/devices[' . $_logical_id . ']', $_serverId);
         if (count($result) == 0) {
             nodejs::pushUpdate('jeedom::alert', array('level' => 'danger', 'message' => __('Aucun module trouvé correspondant à cette ID : ', __FILE__) . $_logical_id));
             return;
         }
         $eqLogic = new eqLogic();
         $eqLogic->setEqType_name('openzwave');
         $eqLogic->setIsEnable(1);
         $eqLogic->setLogicalId($_logical_id);
         if (isset($result['data']['product_name']['value']) && trim($result['data']['product_name']['value']) != '') {
             $eqLogic->setName($eqLogic->getLogicalId() . ' ' . $result['data']['product_name']['value']);
         } else {
             $eqLogic->setName('Device ' . $_logical_id);
         }
         $eqLogic->setConfiguration('product_name', $result['data']['product_name']['value']);
         $eqLogic->setConfiguration('manufacturer_id', $result['data']['manufacturerId']['value']);
         $eqLogic->setConfiguration('product_type', $result['data']['manufacturerProductType']['value']);
         $eqLogic->setConfiguration('product_id', $result['data']['manufacturerProductId']['value']);
         $eqLogic->setConfiguration('serverID', $_serverId);
         $eqLogic->setIsVisible(1);
         $eqLogic->save();
         $eqLogic = openzwave::byId($eqLogic->getId());
         $include_device = $eqLogic->getId();
         $eqLogic->createCommand(false, $result);
         nodejs::pushUpdate('zwave::includeDevice', $include_device);
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => ''));
         return;
     }
     $results = self::callOpenzwave('/ZWaveAPI/Run/network.GetNodesList()', $_serverId);
     $findDevice = array();
     $include_device = '';
     if (count($results['devices']) < 2) {
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Le nombre de module trouvé est inférieure à 2', __FILE__)));
         return;
     }
     foreach ($results['devices'] as $nodeId => $result) {
         $findDevice[$nodeId] = $nodeId;
         if (isset($result['description']['is_static_controller']) && $result['description']['is_static_controller']) {
             continue;
         }
         if (!isset($result['product']['is_valid']) || !$result['product']['is_valid']) {
             continue;
         }
         $eqLogic = self::getEqLogicByLogicalIdAndServerId($nodeId, $_serverId);
         if (!is_object($eqLogic)) {
             $eqLogic = new eqLogic();
             $eqLogic->setEqType_name('openzwave');
             $eqLogic->setIsEnable(1);
             $eqLogic->setLogicalId($nodeId);
             if (isset($result['description']['product_name']) && trim($result['description']['product_name']) != '') {
                 $eqLogic->setName($eqLogic->getLogicalId() . ' ' . $result['description']['product_name']);
             } else {
                 $eqLogic->setName('Device ' . $nodeId);
             }
             $eqLogic->setConfiguration('product_name', $result['description']['product_name']);
             $eqLogic->setConfiguration('manufacturer_id', $result['product']['manufacturer_id']);
             $eqLogic->setConfiguration('product_type', $result['product']['product_type']);
             $eqLogic->setConfiguration('product_id', $result['product']['product_id']);
             $eqLogic->setConfiguration('serverID', $_serverId);
             $eqLogic->setIsVisible(1);
             $eqLogic->save();
             $eqLogic = openzwave::byId($eqLogic->getId());
             $include_device = $eqLogic->getId();
             $eqLogic->createCommand(false, $result);
         } else {
             if (isset($result['description']['product_name'])) {
                 $eqLogic->setConfiguration('product_name', $result['description']['product_name']);
             }
             if (isset($result['product']['is_valid']) && $result['product']['is_valid']) {
                 $eqLogic->setConfiguration('manufacturer_id', $result['product']['manufacturer_id']);
                 $eqLogic->setConfiguration('product_type', $result['product']['product_type']);
                 $eqLogic->setConfiguration('product_id', $result['product']['product_id']);
             }
             $eqLogic->save();
         }
     }
     if (config::byKey('autoRemoveExcludeDevice', 'openzwave') == 1) {
         foreach (self::byType('openzwave') as $eqLogic) {
             if (!isset($findDevice[$eqLogic->getLogicalId()]) && $eqLogic->getConfiguration('serverID') == $_serverId) {
                 $eqLogic->remove();
             }
         }
     }
     nodejs::pushUpdate('zwave::includeDevice', $include_device);
     nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => ''));
 }
Beispiel #22
0
 public static function fromHumanReadable($_input)
 {
     return scenario::fromHumanReadable(eqLogic::fromHumanReadable(cmd::humanReadableToCmd($_input)));
 }
Beispiel #23
0
if (!isConnect('admin')) {
    throw new Exception('Error 401 Unauthorized');
}
sendVarToJS('eqType', 'alarm');
?>
<div class="row">
    <div class="col-lg-2">
        <div class="bs-sidebar affix">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav fixnav">
                <li class="nav-header">Liste des alarmes
                    <i class="fa fa-plus-circle pull-right cursor eqLogicAction" data-action="add" style="font-size: 1.5em;margin-bottom: 5px;"></i>
                </li>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="Rechercher" style="width: 100%"/></li>
                <?php 
foreach (eqLogic::byType('alarm') as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName() . '</a></li>';
}
?>
            </ul>
        </div>
    </div>
    <div class="col-lg-10 eqLogic" style="border-left: solid 1px #EEE; padding-left: 25px;display: none;">
        <form class="form-horizontal">
            <fieldset>
                <legend>Général</legend>
                <div class="form-group">
                    <label class="col-lg-2 control-label">Nom de l'alarme</label>
                    <div class="col-lg-3">
                        <input type="text" class="eqLogicAttr form-control" data-l1key="id" style="display : none;" />
                        <input type="text" class="eqLogicAttr form-control" data-l1key="name" placeholder="Nom de la zone"/>
Beispiel #24
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('denonavr');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un template}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>

 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend>{{Mes Denons}}
  </legend>

  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$eqLogics = eqLogic::byType('homebridge');
sendVarToJS('eqType', 'homebridge');
?>

<div class="row row-overflow">
    <div class="col-md-2">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un équipement}}</a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
                <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true, true) . '</a></li>';
}
?>
            </ul>
        </div>
    </div>
    <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
	    <legend>{{Mes commandes Homebridge}}
	    </legend>
	    <div class="eqLogicThumbnailContainer">
	      <div class="cursor eqLogicAction" data-action="add" style="background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
	         <center>
	            <i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
	        </center>
Beispiel #26
0
                <option value="all">{{Tous}}</option>
                <?php 
foreach (eqLogic::all() as $eqLogic) {
    echo '<option value="' . $eqLogic->getId() . '" >' . $eqLogic->getHumanName() . '</option>';
}
?>
           </select>
       </div>
   </div>
   <div class="form-group">
    <label class="col-sm-6 control-label">{{Limiter au plugin}}</label>
    <div class="col-sm-4">
        <select class='interactAttr form-control' data-l1key='filtres' data-l2key='plugin'>
            <option value="all">{{Tous}}</option>
            <?php 
foreach (eqLogic::allType() as $type) {
    echo '<option value="' . $type['type'] . '" >' . $type['type'] . '</option>';
}
?>
       </select>
   </div>
</div>

<div class="form-group">
    <label class="col-sm-6 control-label">{{Limiter à la catégorie}}</label>
    <div class="col-sm-4">
        <select class='interactAttr form-control' data-l1key='filtres' data-l2key='eqLogic_category'>
            <option value="all">{{Toutes}}</option>
            <?php 
foreach (jeedom::getConfiguration('eqLogic:category') as $key => $value) {
    echo '<option value="' . $key . '">{{' . $value['name'] . '}}</option>';
Beispiel #27
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
sendVarToJS('eqType', 'trains');
$eqLogics = eqLogic::byType('trains');
?>

<div class="row row-overflow">
    <div class="col-lg-2 col-md-3 col-sm-4">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter une liste}}</a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
                <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName() . '</a></li>';
}
?>
            </ul>
        </div>
    </div>
	<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
        <legend>{{Mes listes}}</legend>
        <?php 
if (count($eqLogics) == 0) {
    echo "<br/><br/><br/><center><span style='color:#767676;font-size:1.2em;font-weight: bold;'>{{Vous n'avez pas encore de liste, cliquez sur Ajouter une liste pour commencer}}</span></center>";
} else {
    ?>
            <div class="eqLogicThumbnailContainer">
Beispiel #28
0
 public static function syncEqLogicWithTeslaSite($_logical_id = null)
 {
     $message = '';
     try {
         $list = self::listAllVehicles();
         $num = $list->{'count'};
     } catch (Exception $e) {
         $num = -1;
         $message = displayExeption($e);
         log::add('tesla', 'error', $e);
     }
     if ($num <= 0) {
         if ($message == '') {
             $message = "Aucun vehicule identifie via l'API Tesla";
         }
         nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __($message, __FILE__)));
         return;
     }
     foreach ($list->{'response'} as $car) {
         $eqLogic = self::byLogicalId($car->{'vehicle_id'}, 'tesla');
         if (!is_object($eqLogic)) {
             $eqLogic = new eqLogic();
             $eqLogic->setEqType_name('tesla');
             $eqLogic->setIsEnable(1);
             $eqLogic->setLogicalId($car->{'vehicle_id'});
             $eqLogic->setName($car->{'display_name'});
             $eqLogic->setConfiguration('options_codes', $car->{'options_codes'});
             $eqLogic->setConfiguration('vin', $car->{'vin'});
             $eqLogic->setConfiguration('state', $car->{'state'});
             $eqLogic->setConfiguration('id', $car->{'id'});
             $eqLogic->setIsVisible(1);
             $eqLogic->save();
             //$eqLogic = tesla::byId($eqLogic->getId());
             //$include_device = $eqLogic->getId();
             //$eqLogic->createCommand(false, $result);
             log::add('tesla', 'error', ' Voiture ajoutee, VIN: ' . $car->{'vin'});
             nodejs::pushUpdate('jeedom::alert', array('level' => 'info', 'message' => 'Nouvelle voiture ajoutee'));
         } else {
             // update data here
             $eqLogic->setName($car->{'display_name'});
             $eqLogic->setConfiguration('options_codes', $car->{'options_codes'});
             $eqLogic->setConfiguration('vin', $car->{'vin'});
             $eqLogic->setConfiguration('state', $car->{'state'});
             log::add('tesla', 'error', 'Voiture mise a jour, VIN: ' . $car->{'vin'});
             $eqLogic->save();
         }
     }
     return;
 }
Beispiel #29
0
        }
        if ($controlerState === 0) {
            echo '<div id="div_inclusionAlert' . $id . '"></div>';
        }
        if ($controlerState === 1) {
            echo '<div class="alert jqAlert alert-warning" id="div_inclusionAlert' . $id . '" style="margin : 0px 5px 15px 15px; padding : 7px 35px 7px 15px;">{{Vous êtes en mode inclusion sur ' . $server['name'] . '. Cliquez à nouveau sur le bouton d\'inclusion pour sortir de ce mode}}</div>';
        }
        if ($controlerState === 5) {
            echo '<div class="alert jqAlert alert-warning" id="div_inclusionAlert' . $id . '" style="margin : 0px 5px 15px 15px; padding : 7px 35px 7px 15px;">{{Vous êtes en mode exclusion sur ' . $server['name'] . '. Cliquez à nouveau sur le bouton d\'exclusion pour sortir de ce mode}}</div>';
        }
        if ($controlerState === null) {
            echo '<div class="alert jqAlert alert-danger" style="margin : 0px 5px 15px 15px; padding : 7px 35px 7px 15px;">{{Impossible de contacter le serveur Z-wave ' . $server['name'] . '.}}</div>';
        }
    }
}
$eqLogics = eqLogic::byType('openzwave');
$tags = array();
if (is_array($eqLogics)) {
    foreach ($eqLogics as $eqLogic) {
        $tags[$eqLogic->getLogicalId()] = $eqLogic->getHumanName(true);
    }
}
sendVarTojs('eqLogic_human_name', $tags);
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <?php 
if ($controlerState == 1) {
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
sendVarToJS('eqType', 'jebble');
$eqLogics = eqLogic::byType('jebble');
?>

<div class="row row-overflow">
    <div class="col-lg-2 col-md-3 col-sm-4">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un profil}}</a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
                <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName() . '</a></li>';
}
?>
            </ul>
        </div>
    </div>
	<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
        <legend>{{Mes profils}}</legend>
        <?php 
if (count($eqLogics) == 0) {
    echo "<br/><br/><br/><center><span style='color:#767676;font-size:1.2em;font-weight: bold;'>{{Vous n'avez pas encore de profil, cliquez sur Ajouter un profil pour commencer}}</span></center>";
} else {
    ?>
            <div class="eqLogicThumbnailContainer">