当前位置: 首页>>代码示例>>PHP>>正文


PHP eqLogic::byType方法代码示例

本文整理汇总了PHP中eqLogic::byType方法的典型用法代码示例。如果您正苦于以下问题:PHP eqLogic::byType方法的具体用法?PHP eqLogic::byType怎么用?PHP eqLogic::byType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eqLogic的用法示例。


在下文中一共展示了eqLogic::byType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cron30

 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();
             }
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-karotz,代码行数:32,代码来源:karotz.class.php

示例2: pull

 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);
             }
         }
     }
 }
开发者ID:conselio,项目名称:jeedom_mysensors,代码行数:27,代码来源:mySensors.class.php

示例3: cron

 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);
             }
         }
     }
 }
开发者ID:skyline-ch,项目名称:plugin-virtual,代码行数:26,代码来源:virtual.class.php

示例4: openzwave_update

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";
}
开发者ID:stef3569,项目名称:plugin-openzwave,代码行数:59,代码来源:install.php

示例5: cronHourly

 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();
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-porkfolio,代码行数:57,代码来源:porkfolio.class.php

示例6: cron

 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();
         }
     }
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:9,代码来源:alarm.class.php

示例7: openzwave_update

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";
}
开发者ID:kaneda-fr,项目名称:plugin-openzwave,代码行数:57,代码来源:install.php

示例8: karotz_update

function karotz_update()
{
    foreach (eqLogic::byType('karotz') as $karotz) {
        foreach ($karotz->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $karotz->save();
    }
}
开发者ID:jeedom,项目名称:plugin-karotz,代码行数:11,代码来源:install.php

示例9: nabaztag_update

function nabaztag_update()
{
    foreach (eqLogic::byType('nabaztag') as $nabaztag) {
        foreach ($nabaztag->getCmd() as $cmd) {
            if ($cmd->getLogicalId() == '') {
                $cmd->remove();
            }
        }
        $nabaztag->save();
    }
}
开发者ID:jeedom,项目名称:plugin-nabaztag,代码行数:11,代码来源:install.php

示例10: getDisplayIds

 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;
 }
开发者ID:edouardkleinhans,项目名称:jebble_jeedom,代码行数:12,代码来源:jebble_v2.class.php

示例11: cron30

 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());
             }
         }
     }
 }
开发者ID:jeedom,项目名称:plugin-wazeintime,代码行数:51,代码来源:wazeintime.class.php

示例12: cron

 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();
             }
         }
     }
 }
开发者ID:bemar,项目名称:jeedom_trains,代码行数:43,代码来源:trains.class.php

示例13: openzwave_update

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();
}
开发者ID:sfrias,项目名称:plugin-openzwave,代码行数:20,代码来源:install.php

示例14: ecodevice_remove

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();
    }
}
开发者ID:jooooooon,项目名称:plugin-ecodevice,代码行数:20,代码来源:install.php

示例15: pull

 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);
         }
     }
 }
开发者ID:kaneda-fr,项目名称:jeedom_tesla,代码行数:36,代码来源:tesla.class.php


注:本文中的eqLogic::byType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。