예제 #1
0
     ajax::success(zwave::inspectQueue(init('serverId', 1)));
 }
 if (init('action') == 'getRoutingTable') {
     ajax::success(zwave::getRoutingTable(init('serverId', 1)));
 }
 if (init('action') == 'updateRoute') {
     if (init('id') == '') {
         ajax::success(zwave::updateAllRoute(init('serverId', 1)));
     } else {
         $results = zwave::callRazberry('/ZWaveAPI/Data/0', init('serverId', 1));
         $razberry_id = $results['controller']['data']['nodeId']['value'];
         if ($razberry_id == init('id')) {
             zwave::callRazberry('/ZWaveAPI/Run/devices[' . $razberry_id . '].RequestNodeNeighbourUpdate()', init('serverId', 1));
             ajax::success();
         } else {
             $eqLogic = zwave::getEqLogicByLogicalIdAndServerId(init('id'), init('serverId', 1));
             if (!is_object($eqLogic)) {
                 throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id'));
             }
             ajax::success($eqLogic->updateRoute());
         }
     }
 }
 if (init('action') == 'copyDeviceConfiguration') {
     $eqLogic = zwave::byId(init('id'));
     if (!is_object($eqLogic)) {
         throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id'));
     }
     $eqLogic->setDeviceConfigurationFromDevice(init('copy_id'));
     ajax::success();
 }
예제 #2
0
 public function getAssociation()
 {
     $results = self::callRazberry('/ZWaveAPI/Run/devices[' . $this->getLogicalId() . '].instances[0].commandClasses[133].data', $this->getConfiguration('serverID', 1));
     if (!isset($results['supported']) || !isset($results['supported']['value']) || $results['supported']['value'] == false) {
         throw new Exception(__('Ce module ne supporte pas la notion de groupe', __FILE__));
     }
     $hasGroup = false;
     $razberry_id = zwave::getZwaveInfo('controller::data::nodeId::value', $this->getConfiguration('serverID', 1));
     foreach ($results as $group => &$values) {
         if (is_numeric($group)) {
             $hasGroup = true;
             $info_group = array();
             foreach ($values['nodes']['value'] as $node) {
                 if ($node == $razberry_id) {
                     $info_group[] = array('id' => $node, 'name' => 'Jeedom');
                 } else {
                     $eqLogic = zwave::getEqLogicByLogicalIdAndServerId($this->getConfiguration('serverID', 1));
                     if (is_object($eqLogic)) {
                         $info_group[] = array('id' => $node, 'name' => $eqLogic->getHumanName());
                     } else {
                         $info_group[] = array('id' => $node, 'name' => $node);
                     }
                 }
             }
             $values['nodes']['value'] = $info_group;
         }
     }
     if (!$hasGroup) {
         self::callRazberry('/ZWaveAPI/Run/devices[' . $this->getLogicalId() . '].instances[0].commandClasses[133].Get()', $this->getConfiguration('serverID', 1));
         throw new Exception(__('Aucun groupe trouvé, veuillez retester dans 10 min le temps d\'interroger le module', __FILE__));
     }
     return $results;
 }