Пример #1
0
 public static function pull($_options)
 {
     $weather = weather::byId($_options['weather_id']);
     if (is_object($weather) && $weather->getIsEnable() == 1) {
         if (jeedom::isDateOk()) {
             $sunrise = $weather->getCmd(null, 'sunrise')->execCmd();
             $sunset = $weather->getCmd(null, 'sunset')->execCmd();
             if ($sunrise < 500 || $sunrise > 1000) {
                 $sunrise = 500;
             }
             if ($sunset > 2300 || $sunset < 1600) {
                 $sunset = 1600;
             }
             if (date('Gi') + 100 >= $sunrise && date('Gi') + 100 < $sunset) {
                 $weather->getCmd(null, 'sunrise')->event($sunrise);
             } else {
                 $weather->getCmd(null, 'sunset')->event($sunset);
             }
         }
         $weather->reschedule();
     } else {
         $cron = cron::byClassAndFunction('weather', 'pull', $_options);
         if (is_object($cron)) {
             $cron->remove();
         }
     }
 }
Пример #2
0
 public function execute($_trigger = '', $_message = '')
 {
     if ($this->getIsActive() != 1) {
         $this->setLog(__('Impossible d\'exécuter le scénario : ', __FILE__) . $this->getHumanName() . __(' sur : ', __FILE__) . $_message . __(' car il est désactivé', __FILE__));
         $this->persistLog();
         return;
     }
     if ($this->getConfiguration('timeDependency', 0) == 1 && !jeedom::isDateOk()) {
         $this->setLog(__('Lancement du scénario : ', __FILE__) . $this->getHumanName() . __(' annulé car il utilise une condition de type temporelle et que la date système n\'est pas OK', __FILE__));
         $this->persistLog();
         return;
     }
     $cmd = cmd::byId(str_replace('#', '', $_trigger));
     if (is_object($cmd)) {
         log::add('event', 'event', __('Exécution du scénario ', __FILE__) . $this->getHumanName() . __(' déclenché par : ', __FILE__) . $cmd->getHumanName());
     } else {
         log::add('event', 'event', __('Exécution du scénario ', __FILE__) . $this->getHumanName() . __(' déclenché par : ', __FILE__) . $_trigger);
     }
     $this->setLog(__('Début d\'exécution du scénario : ', __FILE__) . $this->getHumanName() . '. ' . $_message);
     $this->setLastLaunch(date('Y-m-d H:i:s'));
     if ($this->getConfiguration('speedPriority', 0) == 0) {
         $this->setDisplay('icon', '');
         $this->setState('in progress');
         $this->setPID(getmypid());
         $this->save();
     }
     $this->setRealTrigger($_trigger);
     foreach ($this->getElement() as $element) {
         $element->execute($this);
     }
     if ($this->getConfiguration('speedPriority', 0) == 0) {
         $this->setState('stop');
         $this->setPID('');
     }
     $this->setLog(__('Fin correcte du scénario', __FILE__));
     $this->persistLog();
     $this->save();
     if ($this->getReturn() != '') {
         return $this->getReturn();
     }
     return true;
 }
Пример #3
0
			<td style="font-weight : bold;">{{Démarré}}</td>
			<?php 
if (!jeedom::isStarted()) {
    echo '<td class="alert alert-danger">{{NOK}}</td>';
    echo '<td></td>';
} else {
    echo '<td class="alert alert-success">{{OK}}</td>';
    echo '<td></td>';
}
?>
		</tr>

		<tr>
			<td style="font-weight : bold;">{{Date système}}</td>
			<?php 
if (!jeedom::isDateOk()) {
    echo '<td class="alert alert-danger">' . date('Y-m-d H:i:s') . '</td>';
    echo '<td></td>';
} else {
    echo '<td class="alert alert-success">{{OK}}</td>';
    echo '<td></td>';
}
?>
		</tr>

		<tr>
			<td style="font-weight : bold;">{{Authentification par défaut}}</td>
			<?php 
if (user::hasDefaultIdentification() == 1) {
    echo '<td class="alert alert-danger">{{NOK}}</td>';
    echo '<td>{{Attention vous avez toujours l\'utilisateur admin/admin de configuré, cela représente une grave faille de sécurité, aller <a href=\'index.php?v=d&p=user\'>ici</a> pour modifier le mot de passe de l\'utilisateur admin}}</td>';
Пример #4
0
    echo $cron->getState();
    echo " | ";
    echo $cron->getSchedule();
    echo " | ";
    echo $cron->getDeamon();
    echo " | ";
    echo $cron->getOnce();
    echo " | ";
    echo $cron->getLastRun();
    echo "\n";
}
echo "\n**************************************************\n";
echo "*                 DATE                           *";
echo "\n**************************************************\n";
echo "Check if Jeedom date's is good...";
if (jeedom::isDateOk()) {
    echo "OK";
} else {
    echo "NOK";
}
$cache = cache::byKey('jeedom::lastDate');
echo " (" . $cache->getValue() . ")\n";
echo "\n**************************************************\n";
echo "*                 MESSAGE                        *";
echo "\n**************************************************\n";
echo "DATE | PLUGIN | LOGICALID | MESSAGE\n";
foreach (message::all() as $message) {
    echo $message->getDate();
    echo " | ";
    echo $message->getPlugin();
    echo " | ";