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); } } } }
public static function cron() { foreach (eqLogic::byType('virtual') as $eqLogic) { $autorefresh = $eqLogic->getConfiguration('autorefresh'); if ($eqLogic->getIsEnable() == 1 && $autorefresh != '') { try { $c = new Cron\CronExpression($autorefresh, new Cron\FieldFactory()); if ($c->isDue()) { try { foreach ($eqLogic->getCmd('info') as $cmd) { $value = $cmd->execute(); if ($cmd->execCmd() != $cmd->formatValue($value)) { $cmd->setCollectDate(''); $cmd->event($value); } } } catch (Exception $exc) { log::add('virtual', 'error', __('Erreur pour ', __FILE__) . $eqLogic->getHumanName() . ' : ' . $exc->getMessage()); } } } catch (Exception $exc) { log::add('virtual', 'error', __('Expression cron non valide pour ', __FILE__) . $eqLogic->getHumanName() . ' : ' . $autorefresh); } } } }
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(); } } }
public static function cron() { foreach (eqLogic::byType('alarm') as $eqLogic) { $cmd_armed = cmd::byId($eqLogic->getConfiguration('cmd_armed_id')); if ($cmd_armed->execCmd() == 1) { $eqLogic->ping(); } } }
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"; }
function karotz_update() { foreach (eqLogic::byType('karotz') as $karotz) { foreach ($karotz->getCmd() as $cmd) { if ($cmd->getLogicalId() == '') { $cmd->remove(); } } $karotz->save(); } }
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()); } } } }
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(); } } } }
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(); }
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 static function pull($_options) { //log::add('tesla', 'error', "Vehicle data updated through API"); //if $eqLogics = eqLogic::byType('tesla'); // ne pas oublier de modifier pour le nom de votre plugin // la liste des équipements try { $list = tesla::listAllVehicles(); } catch (Exception $e) { $message = displayExeption($e); //TODO: Not Used log::add('tesla', 'error', $e); } foreach ($eqLogics as $eqLogic) { log::add('tesla', 'error', "Pulling data for " . $eqLogic->getHumanName(false, false) . " VIN: " . $eqLogic->getConfiguration('vin')); foreach ($list->{'response'} as $car) { if ($car->{'vehicle_id'} == $eqLogic->getLogicalId()) { $eqLogic->setConfiguration('state', $car->{'state'}); } } try { log::add('tesla', 'error', "Getting Data "); $carData = tesla::getVehicleData($eqLogic->getConfiguration('id')); log::add('tesla', 'error', $carData); foreach ($eqLogic->getCmd('info') as $cmd) { $cmd->event($carData->{$cmd->getLogicalId()}); log::add('tesla', 'error', "Adding " . $cmd->getLogicalId() . " : " . $carData->{$cmd->getLogicalId()}); } } catch (Exception $e) { $message = displayExeption($e); //TODO: Not Used log::add('tesla', 'error', $e); } } }
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">
} 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>
<?php if (!isConnect('admin')) { throw new Exception('{{401 - Accès non autorisé}}'); } sendVarToJS('eqType', 'wazeintime'); $eqLogics = eqLogic::byType('wazeintime'); ?> <div class="row row-overflow"> <div class="col-lg-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 trajet}}</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 Trajets}} </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> <span style="font-size : 1.1em;position:relative; top : 23px;word-break: break-all;white-space: pre-wrap;word-wrap: break-word;;color:#94ca02"><center>Ajouter</center></span>
} global $listCmdXBMC; include_file('core', 'xbmc', 'config', 'xbmc'); sendVarToJS('eqType', 'xbmc'); ?> <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 equipements XBMC <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('xbmc') 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'équipement XBMC</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 l'équipement XBMC"/>
<?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">
<?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é}}'); } global $listCmdlgTV; include_file('core', 'lgTV', 'config', 'lgTV'); sendVarToJS('eqType', 'lgTV'); $eqLogics = eqLogic::byType('lgTV'); ?> <div class="row row-overflow"> <div class="col-lg-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 une TV}}</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 TVs}} </legend> <div class="eqLogicThumbnailContainer"> <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" > <i class="fa fa-plus-circle" style="font-size : 7em;color:#28a3d3;"></i>
$eqLogic->setEqType_name('openzwave'); $server_id = $eqLogic->getConfiguration('serverID', 1); if (isset($server_convertion[$server_id])) { $server_id = $server_convertion[$server_id]; } else { $server_id = 0; } $eqLogic->setConfiguration('serverID', $server_id); foreach ($eqLogic->getCmd() as $cmd) { $cmd->setEqType('openzwave'); $cmd->save(); } $eqLogic->save(); } $replace = array('.level' => '.val', 'data.' => 'data[0].', 'data[0].sensorState.value' => 'data[0].val', 'Set(#slider#)' => 'data[0].Set(#slider#)', 'Reset()' => 'data[0].PressButton()'); foreach (eqLogic::byType('openzwave') as $eqLogic) { foreach ($eqLogic->getCmd() as $cmd) { $cmd->setConfiguration('value', str_replace(array_keys($replace), $replace, $cmd->getConfiguration('value'))); if ($cmd->getConfiguration('class') == '0x80') { $cmd->setConfiguration('value', str_replace('data.last', 'data[0].val', $cmd->getConfiguration('value'))); $cmd->setConfiguration('value', str_replace('data[0].last', 'data[0].val', $cmd->getConfiguration('value'))); } if ($cmd->getConfiguration('class') == '0x30') { $cmd->setConfiguration('value', str_replace('data[1].val', 'data[0].val', $cmd->getConfiguration('value'))); } $value = $cmd->getConfiguration('value'); preg_match_all("/Set\\(([0-9]*)\\)/", $value, $matches); if (count($matches) == 2 && @is_numeric($matches[1][0]) && @$matches[1][0] != '') { $value = 'data[0].Set(' . $matches[1][0] . ')'; } preg_match_all("/Set\\(([0-9]*),([0-9]*)\\)/", $value, $matches);
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"/>
<?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>
<?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">
} 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) {
public static function cron15() { foreach (eqLogic::byType('denonavr', true) as $eqLogic) { $eqLogic->updateInfo(); } }