Beispiel #1
0
if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
include_file('3rdparty', 'jquery.fileupload/jquery.ui.widget', 'js');
include_file('3rdparty', 'jquery.fileupload/jquery.iframe-transport', 'js');
include_file('3rdparty', 'jquery.fileupload/jquery.fileupload', 'js');
sendVarToJS('eqType', 'openzwave');
sendVarToJS('marketAddr', config::byKey('market::address'));
sendVarToJS('listServerZwave', openzwave::listServerZwave());
echo '<div id="div_inclusionAlert"></div>';
$controlerState = 0;
$state = 10;
foreach (openzwave::listServerZwave() as $id => $server) {
    if (isset($server['name'])) {
        try {
            $controlerState = openzwave::callOpenzwave('/ZWaveAPI/Run/network.GetControllerStatus()', $id);
            if (isset($controlerState['result']['data'])) {
                $state = $controlerState['result']['data']['networkstate']['value'];
                $controlerState = $controlerState['result']['data']['mode']['value'];
            }
        } catch (Exception $e) {
            $controlerState = null;
        }
        if ($state < 7) {
            echo '<div class="alert jqAlert alert-warning" id="div_inclusionAlert' . $id . '" style="margin : 0px 5px 15px 15px; padding : 7px 35px 7px 15px;">{{Openzwave est en cours de démarrage sur ' . $server['name'] . '.}}</div>';
        }
        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>';
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Jeedom is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
if (init('id') == '') {
    throw new Exception('{{EqLogic ID ne peut être vide}}');
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
    throw new Exception('{{EqLogic non trouvé}}');
}
include_file('3rdparty', 'jsonTree/jsonTree', 'css', 'openzwave');
include_file('3rdparty', 'jsonTree/jsonTree', 'js', 'openzwave');
$json = openzwave::callOpenzwave('/ZWaveAPI/Run/devices[' . $eqLogic->getLogicalId() . ']', $eqLogic->getConfiguration('serverID', 1));
sendVarToJs('zwaveDataTree', $json);
?>
<div id="div_zwaveDataTree"></div>
<script>
    $('#div_zwaveDataTree').html(JSONTree.create(zwaveDataTree));
</script>
 public function sendZwaveResquest($_url, $_options = array())
 {
     $eqLogic = $this->getEqLogic();
     if ($this->getType() == 'action') {
         if (isset($_options['speedAndNoErrorReport']) && $_options['speedAndNoErrorReport'] == true) {
             openzwave::callOpenzwave($_url, $eqLogic->getConfiguration('serverID', 1), 1, true);
         } else {
             openzwave::callOpenzwave($_url, $eqLogic->getConfiguration('serverID', 1));
         }
         return;
     }
     $result = openzwave::callOpenzwave($_url, $eqLogic->getConfiguration('serverID', 1));
     if (is_array($result)) {
         $value = self::handleResult($result);
         if (isset($result['updateTime'])) {
             $this->setCollectDate(date('Y-m-d H:i:s', $result['updateTime']));
         }
     } else {
         $value = $result;
         if ($value === true) {
             return 1;
         }
         if ($value === false) {
             return 0;
         }
         if (is_numeric($value)) {
             return round($value, 2);
         }
     }
     return $value;
 }
 if (init('action') == 'changeIncludeState') {
     openzwave::changeIncludeState(init('mode'), init('state'), init('serverID'));
     ajax::success();
 }
 if (init('action') == 'restartDeamon') {
     $cron = cron::byClassAndFunction('zwave', 'pull');
     if (is_object($cron)) {
         $cron->stop();
     }
     ajax::success();
 }
 if (init('action') == 'getControllerState') {
     ajax::success(openzwave::callOpenzwave('/ZWaveAPI/Run/network.GetControllerStatus()', init('serverID')));
 }
 if (init('action') == 'callRazberry') {
     ajax::success(openzwave::callOpenzwave(init('call'), init('serverId', 1)));
 }
 if (init('action') == 'listServerZwave') {
     ajax::success(openzwave::listServerZwave());
 }
 if (init('action') == 'autoDetectModule') {
     $eqLogic = openzwave::byId(init('id'));
     if (!is_object($eqLogic)) {
         throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id'));
     }
     foreach ($eqLogic->getCmd() as $cmd) {
         $cmd->remove();
     }
     $eqLogic->createCommand(true);
     ajax::success();
 }
			<th>1</th>
			<th>2</th>
			<th>3</th>
			<th>4</th>
			<th>5</th>
			<th>6</th>
			<th>7</th>
			<th>8</th>
			<th>9</th>
			<th>10</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<?php 
$data = openzwave::callOpenzwave('/ZWaveAPI/Run/devices[' . init('logical_id') . ']', init('serverId'));
$data = $data['instances'][0]['commandClasses'][99]['data'];
for ($i = 1; $i < 11; $i++) {
    echo '<td>';
    echo '<a class="btn btn-success pull-right btn-xs bt_ziptatoKeypadSaveNewCode" data-position="' . $i . '"><i class="fa fa-floppy-o"></i></a>';
    if (isset($data[$i]) && $data[$i]['val'] != '00000000000000000000') {
        echo '<i class="fa fa-check"></i>';
        echo '<a class="btn btn-danger pull-right btn-xs bt_ziptatoKeypadRemoveCode"  data-position="' . $i . '"><i class="fa fa-times"></i></a>';
    } else {
        echo '<i class="fa fa-times"></i>';
    }
    echo '</td>';
}
?>
      </tr>
  </tbody>
<?php

/* This file is part of Jeedom.
 *
 * Jeedom is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Jeedom is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
require_once dirname(__FILE__) . "/../../../../core/php/core.inc.php";
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
if (strpos(init('request'), '/ZWaveAPI/Run/network.SaveZWConfig()') !== false) {
    echo json_encode(openzwave::callOpenzwave(str_replace('//', '/', init('request')), init('server_id'), null, false, init('data')));
} else {
    echo json_encode(openzwave::callOpenzwave(str_replace('//', '/', init('request')), init('server_id')));
}