示例#1
0
function zwave_update()
{
    $cron = cron::byClassAndFunction('zwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('zwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    foreach (zwave::byType('zwave') as $zwave) {
        if ($zwave->getConfiguration('serverID') == '') {
            $zwave->setConfiguration('serverID', 1);
        }
        $zwave->save();
    }
    config::save('zwaveAddr1', config::byKey('zwaveAddr1', 'zwave', config::byKey('zwaveAddr', 'zwave')), 'zwave');
    config::save('zwavePort1', config::byKey('zwavePort1', 'zwave', config::byKey('zwavePort', 'zwave')), 'zwave');
    config::save('isOpenZwave1', config::byKey('isOpenZwave1', 'zwave', config::byKey('isOpenZwave', 'zwave')), 'zwave');
    if (method_exists('zwave', 'listServerZway')) {
        foreach (zwave::listServerZway() as $serverID => $server) {
            if (config::byKey('lastNotificationCheck' . $serverID, 'zwave', 0) == 0) {
                config::save('lastNotificationCheck' . $serverID, strtotime('now'), 'zwave');
            }
        }
    }
}
			<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 = zwave::callRazberry('/ZWaveAPI/Run/devices[' . init('logical_id') . '].instances[0].commandClasses[0x63].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])) {
        echo '<i class="fa fa-check"></i>';
        //echo '<a class="btn btn-danger pull-right btn-xs"><i class="fa fa-times"></i></a>';
    } else {
        echo '<i class="fa fa-times"></i>';
    }
    echo '</td>';
}
?>
		</tr>
	</tbody>
</table>
示例#3
0
        }
        ajax::success($eqLogic->getInfo());
    }
    if (init('action') == 'getDeviceConfiguration') {
        $eqLogic = zwave::byId(init('id'));
        if (!is_object($eqLogic)) {
            throw new Exception('Razberry plugin non trouvé : ' . init('id'));
        }
        ajax::success($eqLogic->getDeviceConfiguration(init('forceRefresh', false), init('parameter_id', null)));
    }
    if (init('action') == 'setDeviceConfiguration') {
        $eqLogic = zwave::byId(init('id'));
        if (!is_object($eqLogic)) {
            throw new Exception('Razberry plugin non trouvé : ' . init('id'));
        }
        ajax::success($eqLogic->setDeviceConfiguration(json_decode(init('configurations'), true)));
    }
    if (init('action') == 'inspectQueue') {
        ajax::success(zwave::inspectQueue());
    }
    if (init('action') == 'getRoutingTable') {
        ajax::success(zwave::getRoutingTable());
    }
    if (init('action') == 'updateRoute') {
        ajax::success(zwave::updateRoute());
    }
    throw new Exception('Aucune methode correspondante');
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
示例#4
0
<?php

chdir(dirname(__FILE__) . '/../');
include_once "./config.php";
include_once "./lib/loader.php";
include_once "./lib/threads.php";
set_time_limit(0);
// connecting to database
$db = new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME);
include_once "./load_settings.php";
include_once DIR_MODULES . "control_modules/control_modules.class.php";
$ctl = new control_modules();
include_once DIR_MODULES . 'zwave/zwave.class.php';
$zwave = new zwave();
$zwave->getConfig();
if (!preg_match('/^http/is', $zwave->config['ZWAVE_API_URL'])) {
    exit;
}
// no API URL set
$tmp = SQLSelectOne("SELECT ID FROM zwave_devices LIMIT 1");
if (!$tmp['ID']) {
    exit;
}
// no devices added -- no need to run this cycle
$connected = 0;
for ($i = 0; $i < 3; $i++) {
    if ($zwave->connect()) {
        $connected = 1;
        $zwave->latestReset = time();
        break;
    } else {
示例#5
0
    echo '<div class="alert alert-info">' . $device['groups']['description'] . '</div>';
}
?>
   <legend>{{Association}}</legend>
   <form class="form-horizontal">
    <fieldset>
        <div class="form-group">
            <label class="col-sm-3 control-label">{{Ajouter association}}</label>
            <div class="col-sm-2">
                <select class="form-control" id="in_configureDeviceAddAssociationGroup"></select>
            </div>
            <div class="col-sm-2">
                <select class="form-control" id="in_configureDeviceAddAssociationNode">
                    <?php 
echo '<option value="' . zwave::getZwaveInfo('controller::data::nodeId::value', $eqLogic->getConfiguration('serverID')) . '">Jeedom</option>';
foreach (zwave::byType('zwave') as $zwave) {
    echo '<option value="' . $zwave->getLogicalId() . '">' . $zwave->getHumanName() . '</option>';
}
?>
               </select>
           </div>
           <div class="col-sm-1">
            <a class="btn btn-success" id="bt_configureDeviceAddAssociation"><i class="fa fa-check-circle"></i> {{Ok}}</a>
        </div>
    </div>
</fieldset>
</form>
<table id="table_configureDeviceAssociation" class="table table-bordered table-condensed">
    <thead>
        <tr>
            <th>{{Numéro de groupe}}</th>
示例#6
0
 * 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é}}');
}
?>
<div id='div_routingTableAlert' style="display: none;"></div>
<span class='pull-left'>
    <select class="form-control expertModeVisible" style="width : 200px;" id="sel_routingTableServerId">
        <?php 
foreach (zwave::listServerZway() as $id => $server) {
    if (isset($server['name'])) {
        echo '<option value="' . $id . '">' . $server['name'] . '</option>';
    }
}
?>
  </select>
</span>
<a class='btn btn-warning btn-xs pull-right updateRoute' data-id="" style='color : white;'><i class="fa fa-refresh"></i> {{Forcer la mise à jour des routes}}</a><br/><br/>

<div id="div_routingTable"></div>

<table class="table table-bordered table-condensed" style="width: 500px;">
    <thead>
        <tr><th colspan="2">{{Légende}}</th></tr>
    </thead>
示例#7
0
            $localZwayServer = true;
        }
    }
}
if (!$localZwayServer && $noServer) {
    $localZwayServer = true;
}
?>
<form class="form-horizontal">
    <fieldset>
        <?php 
foreach (zwave::listServerZway() as $id => $server) {
    if (isset($server['name'])) {
        echo ' <div class="form-group"><label class="col-sm-2 control-label">{{Serveur }}' . $server['name'] . '</label>';
        try {
            $controlerState = zwave::getZwaveInfo('', $id);
            if (!is_array($controlerState)) {
                echo '<div class="col-sm-1"><span class="label label-warning tooltips" title="{{Serveur z-wave démarré mais erreur lors de la récuperation des données}}">NOK {{voir cette <a target="_blank" href="http://doc.jeedom.fr/fr_FR/zwave.html#configuration_du_port_dans_le_zway_server">doc</a>}}</span></div>';
            } else {
                echo '<div class="col-sm-1"><span class="label label-success">OK</span></div>';
            }
        } catch (Exception $e) {
            echo '<div class="col-sm-1"><span class="label label-danger">NOK</span></div>';
        }
        echo '</div>';
    }
}
?>
  </fieldset>
</form>
<form class="form-horizontal">
示例#8
0
                        </div>
                    </fieldset> 
                </form>
            </div>
            <div class="col-lg-6">
                <form class="form-horizontal">
                    <fieldset>
                        <legend>Informations</legend>

                        <div class="form-group">
                            <label class="col-lg-2 control-label">Equipement</label>
                            <div class="col-lg-4">
                                <select class="eqLogicAttr form-control" data-l1key="configuration" data-l2key="device">
                                    <option value="">Aucun</option>
                                    <?php 
foreach (zwave::devicesParameters() as $id => $info) {
    echo '<option value="' . $id . '">' . $info['name'] . '</option>';
}
?>
                                </select>
                            </div>
                            <div class="col-lg-6">
                                <span id="span_marketStatus"></span>
                                <a class="btn btn-default" id="bt_configureDevice"><i class="fa fa-wrench"></i></a>
                                <a class="btn btn-warning" id="bt_shareOnMarket"><i class="fa fa-cloud-upload"></i> Partager</a>
                                <a class="btn btn-success" id="bt_wiewOnMarket"><i class="fa fa-cloud-download"></i> Voir du market</a>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-2 control-label">Batterie</label>
示例#9
0
 public function execute($_options = null)
 {
     $value = $this->getConfiguration('value');
     switch ($this->getType()) {
         case 'action':
             switch ($this->getSubType()) {
                 case 'slider':
                     $value = str_replace('#slider#', $_options['slider'], $value);
                     break;
                 case 'color':
                     $value = str_replace('#color#', $_options['color'], $value);
                     return $this->setRGBColor($value);
                     break;
             }
             break;
     }
     $request = zwave::makeBaseUrl() . '/ZWaveAPI/Run/';
     $request .= 'devices[' . $this->getEqLogic()->getLogicalId() . ']';
     if ($this->getConfiguration('instanceId') != '') {
         $request .= '.instances[' . $this->getConfiguration('instanceId') . ']';
     }
     $request .= '.commandClasses[' . $this->getConfiguration('class') . ']';
     $request .= '.' . $value;
     $http = new com_http($request);
     $result = zwave::handleError($http->exec(1, 3, true));
     if (is_json($result)) {
         $result = json_decode($result, true);
         $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 || $value == 'true') {
             return 1;
         }
         if ($value === false || $value == 'false') {
             return 0;
         }
         if (is_numeric($value)) {
             return round($value, 1);
         }
     }
     return $value;
 }
示例#10
0
			<th>{{ID}}</th>
			<th>{{Serveur}}</th>
			<th>{{Interview}}</th>
			<th>{{Statut}}</th>
			<th>{{Batterie}}</th>
			<th>{{Wakeup time}}</th>
			<th>{{Paquet total}}</th>
			<th>{{% OK}}</th>
			<th>{{Temporisation (ms)}}</th>
			<th>{{Dernière communication}}</th>
			<th>{{Ping}}</th>
		</tr>
	</thead>
	<tbody>
		<?php 
foreach (zwave::byType('zwave') as $eqLogic) {
    $info = $eqLogic->getInfo($infos[$eqLogic->getConfiguration('serverID')]);
    echo "<tr>";
    echo "<td><a href='index.php?v=d&m=zwave&p=zwave&id=" . $eqLogic->getId() . "'>" . $eqLogic->getHumanName() . "</a></td>";
    echo "<td>" . $eqLogic->getLogicalId() . "</td>";
    echo "<td>" . $serverList[$eqLogic->getConfiguration('serverID')]['name'] . "</td>";
    if (isset($info['interviewComplete']['value']) && $info['interviewComplete']['value'] != '') {
        if ($info['interviewComplete']['value'] == __('Complet', __FILE__)) {
            echo "<td><a class='btn btn-xs btn-success bt_showInterview' data-id='" . $eqLogic->getId() . "'><i class='fa fa-check'></i> " . $info['interviewComplete']['value'] . "</a></td>";
        } else {
            echo "<td><a class='btn btn-xs btn-warning bt_showInterview' data-id='" . $eqLogic->getId() . "'><i class='fa fa-times'></i> " . $info['interviewComplete']['value'] . " (" . $info['interviewComplete']['nbIncompleteClass'] . "/" . $info['interviewComplete']['nbClass'] . ")</a></td>";
        }
    } else {
        echo "<td></td>";
    }
    if ($info['state']['value'] == 'Dead') {
示例#11
0
     }
     if (init('command') == 'removeFailed') {
         ajax::success($eqLogic->removeFailed());
     }
     if (init('command') == 'markBatteryFailed') {
         ajax::success($eqLogic->markAsBatteryFailed());
     }
     if (init('command') == 'InterviewForce') {
         ajax::success($eqLogic->InterviewForce(init('instanceId'), init('classId')));
     }
 }
 if (init('action') == 'callRazberry') {
     ajax::success(zwave::callRazberry(init('call'), init('serverId', 1)));
 }
 if (init('action') == 'listServerZway') {
     ajax::success(zwave::listServerZway());
 }
 if (init('action') == 'uploadConfZwave') {
     $uploaddir = dirname(__FILE__) . '/../config';
     if (!file_exists($uploaddir)) {
         mkdir($uploaddir);
     }
     $uploaddir .= '/devices/';
     if (!file_exists($uploaddir)) {
         mkdir($uploaddir);
     }
     if (!file_exists($uploaddir)) {
         throw new Exception(__('Répertoire d\'upload non trouvé : ', __FILE__) . $uploaddir);
     }
     if (!isset($_FILES['file'])) {
         throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
示例#12
0
<?php

chdir(dirname(__FILE__) . '/../');
include_once "./config.php";
include_once "./lib/loader.php";
include_once "./lib/threads.php";
set_time_limit(0);
// connecting to database
$db = new mysql(DB_HOST, '', DB_USER, DB_PASSWORD, DB_NAME);
include_once "./load_settings.php";
include_once DIR_MODULES . "control_modules/control_modules.class.php";
$ctl = new control_modules();
include_once DIR_MODULES . 'zwave/zwave.class.php';
$zwave = new zwave();
$zwave->getConfig();
$tmp = SQLSelectOne("SELECT ID FROM zwave_devices LIMIT 1");
if (!$tmp['ID']) {
    exit;
    // no devices added -- no need to run this cycle
}
if (!$zwave->connect()) {
    echo "Cannot connect to Z-Wave API";
    exit;
    // cannot connect
}
while (1) {
    echo date("H:i:s") . " running " . basename(__FILE__) . "\n";
    setGlobal(str_replace('.php', '', basename(__FILE__)) . 'Run', time());
    // check all web vars
    $zwave->pollUpdates();
    if (file_exists('./reboot') || $_GET['onetime']) {
示例#13
0
 public function sendZwaveResquest($_url)
 {
     $eqLogic = $this->getEqLogic();
     $result = zwave::callRazberry($_url, $eqLogic->getConfiguration('serverID', 1));
     if ($this->getType() == 'action') {
         return;
     }
     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 || $value == 'true') {
             return 1;
         }
         if ($value === false || $value == 'false') {
             return 0;
         }
         if (is_numeric($value)) {
             return round($value, 1);
         }
     }
     return $value;
 }
示例#14
0
 * 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', 'zwave');
include_file('3rdparty', 'jsonTree/jsonTree', 'js', 'zwave');
$json = zwave::callRazberry('/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>
示例#15
0
 * 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 Unauthorized');
}
if (init('id') == '') {
    throw new Exception('EqLogic ID ne peut etre vide');
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
    throw new Exception('EqLogic non trouvé');
}
$device = zwave::devicesParameters($eqLogic->getConfiguration('device'));
sendVarToJS('configureDeviceId', init('id'));
if (is_array($device) && count($device) != 0 && $eqLogic->getConfiguration('device') != '') {
    ?>
    <div id='div_configureDeviceAlert' style="display: none;"></div>
    <form class="form-horizontal">
        <fieldset>
            <legend>Informations <a class="btn btn-success btn-xs pull-right" style="color : white;" id="bt_configureDeviceSend"><i class="fa fa-check"></i> Appliquer</a></legend>

            <div class="form-group">
                <label class="col-lg-3 control-label">Nom de l'équipement</label>
                <div class="col-lg-8">
                    <span class="tooltips label label-default"><?php 
    echo $device['name'];
    ?>
</span>
示例#16
0
 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function setProperty($property, $value, $no_linked = 0)
 {
     startMeasure('setProperty');
     startMeasure('setProperty (' . $property . ')');
     $id = $this->getPropertyByName($property, $this->class_id, $this->id);
     $old_value = '';
     if ($id) {
         $prop = SQLSelectOne("SELECT * FROM properties WHERE ID='" . $id . "'");
         $v = SQLSelectOne("SELECT * FROM pvalues WHERE PROPERTY_ID='" . (int) $id . "' AND OBJECT_ID='" . (int) $this->id . "'");
         $old_value = $v['VALUE'];
         $v['VALUE'] = $value;
         if ($v['ID']) {
             $v['UPDATED'] = date('Y-m-d H:i:s');
             if ($old_value != $value) {
                 SQLUpdate('pvalues', $v);
                 //DebMes("Setting [".$this->object_title.".".$property."] to new value [".$value."]");
             } else {
                 SQLExec("UPDATE pvalues SET UPDATED='" . $v['UPDATED'] . "' WHERE ID='" . $v['ID'] . "'");
                 //DebMes("Setting [".$this->object_title.".".$property."] to the same value [".$value."]");
             }
         } else {
             $v['PROPERTY_ID'] = $id;
             $v['OBJECT_ID'] = $this->id;
             $v['VALUE'] = $value;
             $v['UPDATED'] = date('Y-m-d H:i:s');
             $v['ID'] = SQLInsert('pvalues', $v);
         }
         //DebMes(" $id to $value ");
     } else {
         $prop = array();
         $prop['OBJECT_ID'] = $this->id;
         $prop['TITLE'] = $property;
         $prop['ID'] = SQLInsert('properties', $prop);
         $v['PROPERTY_ID'] = $prop['ID'];
         $v['OBJECT_ID'] = $this->id;
         $v['VALUE'] = $value;
         $v['UPDATED'] = date('Y-m-d H:i:s');
         $v['ID'] = SQLInsert('pvalues', $v);
     }
     if ($prop['KEEP_HISTORY'] > 0) {
         startMeasure('DeleteOldHistory');
         SQLExec("DELETE FROM phistory WHERE VALUE_ID='" . $v['ID'] . "' AND TO_DAYS(NOW())-TO_DAYS(ADDED)>" . (int) $prop['KEEP_HISTORY']);
         endMeasure('DeleteOldHistory', 1);
         $h = array();
         $h['VALUE_ID'] = $v['ID'];
         $h['ADDED'] = date('Y-m-d H:i:s');
         $h['VALUE'] = $value;
         $h['ID'] = SQLInsert('phistory', $h);
     }
     /*
      $h=array();
      $h['ADDED']=date('Y-m-d H:i:s');
      $h['OBJECT_ID']=$this->id;
      $h['VALUE_ID']=$v['ID'];
      $h['OLD_VALUE']=$old_value;
      $h['NEW_VALUE']=$value;
      SQLInsert('history', $h);
     */
     //commands, owproperties, snmpproperties, zwave_properties, mqtt
     $tables = array('commands', 'owproperties', 'snmpproperties', 'zwave_properties', 'mqtt', 'modbusdevices');
     if (!is_array($no_linked) && $no_linked) {
         $no_linked = array();
         foreach ($tables as $t) {
             $no_linked[$k] = '0';
         }
     } elseif (is_array($no_linked)) {
         foreach ($tables as $t) {
             if (!isset($no_linked[$k])) {
                 $no_linked[$k] = '1';
             }
         }
     } else {
         $no_linked = array();
         foreach ($tables as $t) {
             $no_linked[$k] = '1';
         }
     }
     foreach ($tables as $t) {
         if ($no_linked[$t] == '') {
             $no_linked[$t] = '1';
         }
     }
     if ($no_linked['commands'] != '') {
         $commands = SQLSelect("SELECT * FROM commands WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['commands']);
         $total = count($commands);
         for ($i = 0; $i < $total; $i++) {
             $commands[$i]['CUR_VALUE'] = $value;
             SQLUpdate('commands', $commands[$i]);
         }
     }
     if ($no_linked['owproperties'] != '' && file_exists(DIR_MODULES . '/onewire/onewire.class.php')) {
         $owp = SQLSelect("SELECT ID FROM owproperties WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['owproperties']);
         $total = count($owp);
         if ($total) {
             include_once DIR_MODULES . '/onewire/onewire.class.php';
             $on_wire = new onewire();
             for ($i = 0; $i < $total; $i++) {
                 $on_wire->setProperty($owp[$i]['ID'], $value);
             }
         }
     }
     if ($no_linked['snmpproperties'] != '' && file_exists(DIR_MODULES . '/snmpdevices/snmpdevices.class.php')) {
         $snmpdevices = SQLSelect("SELECT ID FROM snmpproperties WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['snmpproperties']);
         $total = count($snmpdevices);
         if ($total) {
             include_once DIR_MODULES . '/snmpdevices/snmpdevices.class.php';
             $snmp = new snmpdevices();
             for ($i = 0; $i < $total; $i++) {
                 $snmp->setProperty($snmpdevices[$i]['ID'], $value);
             }
         }
     }
     if ($no_linked['zwave_properties'] != '' && file_exists(DIR_MODULES . '/zwave/zwave.class.php')) {
         $zwave_properties = SQLSelect("SELECT ID FROM zwave_properties WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['zwave_properties']);
         $total = count($zwave_properties);
         if ($total) {
             include_once DIR_MODULES . '/zwave/zwave.class.php';
             $zwave = new zwave();
             for ($i = 0; $i < $total; $i++) {
                 $zwave->setProperty($zwave_properties[$i]['ID'], $value);
             }
         }
     }
     if ($no_linked['mqtt'] != '' && file_exists(DIR_MODULES . '/mqtt/mqtt.class.php')) {
         $mqtt_properties = SQLSelect("SELECT ID FROM mqtt WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['mqtt']);
         $total = count($mqtt_properties);
         if ($total) {
             include_once DIR_MODULES . '/mqtt/mqtt.class.php';
             $mqtt = new mqtt();
             for ($i = 0; $i < $total; $i++) {
                 $mqtt->setProperty($mqtt_properties[$i]['ID'], $value);
             }
         }
     }
     if ($no_linked['modbusdevices'] != '' && file_exists(DIR_MODULES . '/modbus/modbus.class.php')) {
         $modbusdevices = SQLSelect("SELECT ID FROM modbusdevices WHERE LINKED_OBJECT LIKE '" . DBSafe($this->object_title) . "' AND LINKED_PROPERTY LIKE '" . DBSafe($property) . "' AND " . $no_linked['modbusdevices']);
         $total = count($modbusdevices);
         if ($total) {
             include_once DIR_MODULES . '/modbus/modbus.class.php';
             $modbus = new modbus();
             for ($i = 0; $i < $total; $i++) {
                 $modbus->poll_device($modbusdevices[$i]['ID']);
             }
         }
     }
     if ($prop['ONCHANGE']) {
         global $property_linked_history;
         if (!$property_linked_history[$property][$prop['ONCHANGE']]) {
             $property_linked_history[$property][$prop['ONCHANGE']] = 1;
             global $on_change_called;
             $params = array();
             $params['PROPERTY'] = $property;
             $params['NEW_VALUE'] = (string) $value;
             $params['OLD_VALUE'] = (string) $old_value;
             $this->callMethod($prop['ONCHANGE'], $params);
             unset($property_linked_history[$property][$prop['ONCHANGE']]);
         }
     }
     endMeasure('setProperty (' . $property . ')', 1);
     endMeasure('setProperty', 1);
 }
示例#17
0
 * 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";
if (isset($argv)) {
    foreach ($argv as $arg) {
        $argList = explode('=', $arg);
        if (isset($argList[0]) && isset($argList[1])) {
            $_GET[$argList[0]] = $argList[1];
        }
    }
}
if (php_sapi_name() != 'cli' || isset($_SERVER['REQUEST_METHOD']) || !isset($_SERVER['argc'])) {
    if (config::byKey('api') != init('apikey')) {
        connection::failed();
        echo 'Clef API non valide, vous n\'êtes pas autorisé à effectuer cette action (jeeZwave)';
        die;
    }
}
zwave::pull();