if (isset($device['groups']) && isset($device['groups']['description'])) { 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>
$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">
public function applyModuleConfiguration($_light = false) { $this->setConfiguration('applyDevice', $this->getConfiguration('device')); if ($this->getConfiguration('device') == '') { $this->save(); return true; } $device = self::devicesParameters($this->getConfiguration('device')); if (!is_array($device) || !isset($device['commands'])) { return true; } if (isset($device['configuration'])) { foreach ($device['configuration'] as $key => $value) { try { $this->setConfiguration($key, $value); } catch (Exception $e) { } } } $cmd_order = 0; $link_cmds = array(); $razberry_id = zwave::getZwaveInfo('controller::data::nodeId::value', $this->getConfiguration('serverID', 1)); nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Mise en place des groupes par défaut', __FILE__))); if (isset($device['groups']) && isset($device['groups']['associate'])) { foreach ($this->getAssociation() as $group_id => $associate) { foreach ($associate['nodes']['value'] as $node) { if ($node['id'] == $razberry_id && !isset($device['groups']['associate'][$group_id])) { $this->changeAssociation('remove', $group_id, $razberry_id); } } } foreach ($device['groups']['associate'] as $group) { try { $this->changeAssociation('add', $group, $razberry_id); } catch (Exception $e) { } } } nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Création des commandes', __FILE__))); if (self::$_listZwaveServer == null) { self::listServerZway(); } if (isset($device['commands_openzwave']) && self::$_listZwaveServer[$this->getConfiguration('serverID', 1)]['isOpenZwave'] == 1) { $commands = $device['commands_openzwave']; } else { $commands = $device['commands']; } foreach ($commands as &$command) { if (!isset($command['configuration']['instanceId'])) { $command['configuration']['instanceId'] = 0; } if (!isset($command['configuration']['class'])) { $command['configuration']['class'] = ''; } $cmd = null; foreach ($this->getCmd() as $liste_cmd) { if ($liste_cmd->getConfiguration('instanceId', 0) == $command['configuration']['instanceId'] && $liste_cmd->getConfiguration('class') == $command['configuration']['class'] && $liste_cmd->getConfiguration('value') == $command['configuration']['value']) { $cmd = $liste_cmd; break; } } try { if ($cmd == null || !is_object($cmd)) { $cmd = new zwaveCmd(); $cmd->setOrder($cmd_order); $cmd->setEqLogic_id($this->getId()); } else { $command['name'] = $cmd->getName(); if (isset($command['display'])) { unset($command['display']); } } utils::a2o($cmd, $command); if (isset($command['value'])) { $cmd->setValue(null); } $cmd->save(); if (isset($command['value'])) { $link_cmds[$cmd->getId()] = $command['value']; } $cmd_order++; } catch (Exception $exc) { } } if (count($link_cmds) > 0) { foreach ($this->getCmd() as $eqLogic_cmd) { foreach ($link_cmds as $cmd_id => $link_cmd) { if ($link_cmd == $eqLogic_cmd->getName()) { $cmd = cmd::byId($cmd_id); if (is_object($cmd)) { $cmd->setValue($eqLogic_cmd->getId()); $cmd->save(); } } } } } if (isset($device['wakeup']) && is_numeric($device['wakeup']) && $device['wakeup'] > 1) { try { $this->setWakeUp($device['wakeup']); } catch (Exception $ex) { } } if (!$_light) { try { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Récupération de la configuration d\'origine du module', __FILE__))); $configuration = $this->getDeviceConfiguration(true); $optimiseConfigFound = false; foreach ($configuration as $id => &$parameter) { if (isset($device['parameters'][$id]['set'])) { $optimiseConfigFound = true; $configuration[$id]['value'] = $device['parameters'][$id]['set']; } } if ($optimiseConfigFound) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Envoi de la configuration optimisée Jeedom', __FILE__))); $this->setDeviceConfiguration($configuration); } } catch (Exception $ex) { } if (isset($device['configure']) && is_array($device['configure'])) { try { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Execution des commandes post-configuration', __FILE__))); $this->applyDeviceConfigurationCommand(); } catch (Exception $ex) { } } } $this->save(); nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => '')); }
if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); } $eqLogic->setWakeUp(init('wakeup')); ajax::success(); } if (init('action') == 'setPolling') { $eqLogic = zwave::byId(init('id')); if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); } $eqLogic->setPolling(init('polling')); ajax::success(); } if (init('action') == 'getZwaveInfo') { ajax::success(zwave::getZwaveInfo(init('path'), init('serverId', 1))); } if (init('action') == 'getAssociation') { $eqLogic = zwave::byId(init('id')); if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); } ajax::success($eqLogic->getAssociation()); } if (init('action') == 'changeAssociation') { $eqLogic = zwave::byId(init('id')); if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); } ajax::success($eqLogic->changeAssociation(init('mode'), init('group'), init('node'))); }
<?php 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', 'zwave'); sendVarToJS('marketAddr', config::byKey('market::address')); sendVarToJS('listServerZway', zwave::listServerZway()); echo '<div id="div_inclusionAlert"></div>'; foreach (zwave::listServerZway() as $id => $server) { if (isset($server['name'])) { try { $controlerState = zwave::getZwaveInfo('controller::data::controllerState::value', $id); } catch (Exception $e) { $controlerState = 0; } 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>'; }