diff --git a/core/class/zwavejs.class.php b/core/class/zwavejs.class.php index 8419e95c..a943fc0c 100644 --- a/core/class/zwavejs.class.php +++ b/core/class/zwavejs.class.php @@ -21,7 +21,7 @@ class zwavejs extends eqLogic { - + public static function dependancy_end() { config::save('zwavejsVersion', config::byKey('wantedVersion', __CLASS__), __CLASS__); } @@ -136,7 +136,7 @@ public static function cron() { } } } - + public static function cronHourly() { $deamon_info = self::deamon_info(); if ($deamon_info['state'] != 'ok') { @@ -182,7 +182,7 @@ public static function configureSettings($_path) { $settings['zwave']['logEnabled'] = true; $settings['zwave']['logToFile'] = false; $settings['zwave']['serverEnabled'] = false; - if (config::byKey('softReset', __CLASS__,1) == 1){ + if (config::byKey('softReset', __CLASS__, 1) == 1) { $settings['zwave']['enableSoftReset'] = true; } else { $settings['zwave']['enableSoftReset'] = false; @@ -283,9 +283,9 @@ public static function deamon_info() { } $port = config::byKey('port', __CLASS__); if ($port == 'none') { - $return['launchable'] = 'nok'; - $return['launchable_message'] = __("Le port n'est pas configuré", __FILE__); - }else{ + $return['launchable'] = 'nok'; + $return['launchable_message'] = __("Le port n'est pas configuré", __FILE__); + } else { $port = jeedom::getUsbMapping($port); if (is_array($port) || @!file_exists($port)) { $return['launchable'] = 'nok'; @@ -355,7 +355,7 @@ public static function deamon_start($_debug = false) { $cmd .= ' KEY_S2_Authenticated=' . config::byKey('s2key_auth', __CLASS__); $cmd .= ' KEY_S2_AccessControl=' . config::byKey('s2key_access', __CLASS__); $cmd .= ' SESSION_SECRET=' . 'jeedomSession'; - $cmd .= ' yarn start'; + $cmd .= ' npm start'; log::add(__CLASS__, 'info', __('Démarrage du démon ZwaveJS', __FILE__) . ' : ' . $cmd); exec(system::getCmdSudo() . $cmd . ' >> ' . log::getPathToLog('zwavejsd') . ' 2>&1 &'); $i = 0; @@ -480,13 +480,12 @@ public static function handleClients($_clients) { // log::add(__CLASS__, 'debug', $key); if ($key == 'api') { self::handleApi($value); - } - else if ($key == 'version') { + } else if ($key == 'version') { config::save('zwavejsVersion', $value['value'], __CLASS__); event::add('zwavejs::dependancy_end', array()); - if (config::byKey('wantedVersion', __CLASS__) != config::byKey('zwavejsVersion', __CLASS__)){ + if (config::byKey('wantedVersion', __CLASS__) != config::byKey('zwavejsVersion', __CLASS__)) { sleep(2); - message::add('zwavejs',__("Votre version de ZwaveJS UI n'est pas celle recommandée par le plugin. Vous utilisez actuellement la version ", __FILE__). config::byKey('zwavejsVersion', __CLASS__) .'. '.__('Le plugin nécessite la version ', __FILE__). config::byKey('wantedVersion', __CLASS__) .'. '.__('Veuillez relancer les dépendances pour mettre à jour la librairie.', __FILE__)); + message::add('zwavejs', __("Votre version de ZwaveJS UI n'est pas celle recommandée par le plugin. Vous utilisez actuellement la version ", __FILE__) . config::byKey('zwavejsVersion', __CLASS__) . '. ' . __('Le plugin nécessite la version ', __FILE__) . config::byKey('wantedVersion', __CLASS__) . '. ' . __('Veuillez relancer les dépendances pour mettre à jour la librairie.', __FILE__)); } } } @@ -513,11 +512,11 @@ public static function handleApi($_api) { foreach ($_api as $key => $value) { if ($key == 'abortFirmwareUpdate') { if (isset($value['success']) && $value['success']) { - event::add('zwavejs::firmware_update',array('node' => $value['args'][0], 'cancel'=>true)); + event::add('zwavejs::firmware_update', array('node' => $value['args'][0], 'cancel' => true)); } } else if ($key == 'restoreNVM') { if (isset($value['success']) && !$value['success']) { - event::add('zwavejs::restoreNVM',array('message' => $value['message'])); + event::add('zwavejs::restoreNVM', array('message' => $value['message'])); } } else if ($key == 'getInfo') { self::addFileEvent('getInfo', $value['result']); @@ -718,7 +717,7 @@ public static function handleNode($_node) { } else if ($key == 'node_firmware_update_progress') { $nodeData = $value['data'][0]; $updateData = $value['data'][1]; - event::add('zwavejs::firmware_update',array('node' => $nodeData['id'], 'progress'=>$updateData['progress'],'files'=>$updateData['currentFile'].'/'.$updateData['totalFiles'])); + event::add('zwavejs::firmware_update', array('node' => $nodeData['id'], 'progress' => $updateData['progress'], 'files' => $updateData['currentFile'] . '/' . $updateData['totalFiles'])); } } } @@ -782,7 +781,7 @@ public static function handleController($_controller) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . __('Accorder la securité', __FILE__)); $securityClasses = $value['data'][0]['securityClasses']; $clientSideAuth = $value['data'][0]['clientSideAuth']; - event::add('zwavejs::grant_security_classes', array('classes'=>$securityClasses, 'auth'=>$clientSideAuth)); + event::add('zwavejs::grant_security_classes', array('classes' => $securityClasses, 'auth' => $clientSideAuth)); } else if ($key == 'validate_dsk') { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . __('Validation DSK', __FILE__)); event::add('zwavejs::validate_dsk', $value['data'][0]); @@ -835,10 +834,10 @@ public static function handleNodeNotification($_value_update) { if ($eqLogic->getIsEnable()) { // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . "Le nœud avec l'id : " . $node['id'] . ' existe ' . $eqLogic->getHumanName()); } - $eqLogic->handleNotificationUpdate($change,$cc); + $eqLogic->handleNotificationUpdate($change, $cc); } } - + public static function handleNodeValueUpdate($_value_update) { // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . "Traitement d'un update de value d'un node"); // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . json_encode($_value_update)); @@ -869,13 +868,13 @@ public static function handleNodeValueUpdateDirect($_nodeId, $_value_update) { $eqLogic->updateCmd('0-0-nodeStatus', $data['status']); if ($data['status'] == 'Awake') { $eqLogic->setConfiguration('lastWakeUp', time()); - if ($eqLogic->getConfiguration('missedWakeup', false)){ + if ($eqLogic->getConfiguration('missedWakeup', false)) { $action = '' . __('Equipement', __FILE__) . ''; - if (config::byKey('notifyMissWakeup', __CLASS__, 1)==1 && $eqLogic->getIsEnable()==1){ - if (version_compare(jeedom::version(),'4.4.0','>=')){ - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de se réveiller après avoir raté au minimum 4 réveils.', $action,'Awake-'.$eqLogic->getLogicalId(),true,'alerting'); + if (config::byKey('notifyMissWakeup', __CLASS__, 1) == 1 && $eqLogic->getIsEnable() == 1) { + if (version_compare(jeedom::version(), '4.4.0', '>=')) { + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de se réveiller après avoir raté au minimum 4 réveils.', $action, 'Awake-' . $eqLogic->getLogicalId(), true, 'alerting'); } else { - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de se réveiller après avoir raté au minimum 4 réveils.', $action,'Awake-'.$eqLogic->getLogicalId(),true); + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de se réveiller après avoir raté au minimum 4 réveils.', $action, 'Awake-' . $eqLogic->getLogicalId(), true); } } } @@ -884,21 +883,21 @@ public static function handleNodeValueUpdateDirect($_nodeId, $_value_update) { } if ($data['status'] == 'Dead' && $currentValue == 'Alive') { $action = '' . __('Equipement', __FILE__) . ''; - if (config::byKey('notifyDead', __CLASS__, 1)==1 && $eqLogic->getIsEnable()==1){ - if (version_compare(jeedom::version(),'4.4.0','>=')){ - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de passer au statut Dead.', $action,'Dead-'.$eqLogic->getLogicalId(),true,'alerting'); + if (config::byKey('notifyDead', __CLASS__, 1) == 1 && $eqLogic->getIsEnable() == 1) { + if (version_compare(jeedom::version(), '4.4.0', '>=')) { + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de passer au statut Dead.', $action, 'Dead-' . $eqLogic->getLogicalId(), true, 'alerting'); } else { - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de passer au statut Dead.', $action,'Dead-'.$eqLogic->getLogicalId(),true); + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de passer au statut Dead.', $action, 'Dead-' . $eqLogic->getLogicalId(), true); } } } if ($data['status'] == 'Alive' && $currentValue == 'Dead') { $action = '' . __('Equipement', __FILE__) . ''; - if (config::byKey('notifyDead', __CLASS__, 1)==1 && $eqLogic->getIsEnable()==1){ - if (version_compare(jeedom::version(),'4.4.0','>=')){ - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de passer au statut Alive.', $action,'Alive-'.$eqLogic->getLogicalId(),true,'alertingReturnBack'); + if (config::byKey('notifyDead', __CLASS__, 1) == 1 && $eqLogic->getIsEnable() == 1) { + if (version_compare(jeedom::version(), '4.4.0', '>=')) { + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de passer au statut Alive.', $action, 'Alive-' . $eqLogic->getLogicalId(), true, 'alertingReturnBack'); } else { - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ', vient de passer au statut Alive.', $action,'Alive-'.$eqLogic->getLogicalId(),true); + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ', vient de passer au statut Alive.', $action, 'Alive-' . $eqLogic->getLogicalId(), true); } } } @@ -923,12 +922,12 @@ public static function publishMqttValue($_node, $_path, $_args = array()) { // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . 'Publication Mqtt Value' . $_node . ' ' . $_path . ' ' . json_encode($_args)); mqtt2::publish(config::byKey('prefix', __CLASS__, 'zwave') . '/' . $_node . '/' . $_path . '/set', $_args); } - + public static function cleanHistory() { foreach (self::byType(__CLASS__) as $eqLogic) { - $eqLogic->setCache('waiting',array()); + $eqLogic->setCache('waiting', array()); } - return ; + return; } public static function getInfo() { @@ -1011,15 +1010,15 @@ public static function setNodeValue($_fullpath, $_value) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $_fullpath . ' ' . $_value); $detailsPath = explode('-', $_fullpath, 2); $value = $_value; - if (strpos($_fullpath,'userCode') !== false){ - if (strpos($_value,'0x') !== false){ - $value = array("type"=>"Buffer", "data"=>array_map('hexdec', str_split(str_replace('0x','',$_value), 2))); + if (strpos($_fullpath, 'userCode') !== false) { + if (strpos($_value, '0x') !== false) { + $value = array("type" => "Buffer", "data" => array_map('hexdec', str_split(str_replace('0x', '', $_value), 2))); } else { - $value = '"'.$_value.'"'; + $value = '"' . $_value . '"'; } } self::publishMqttValue($detailsPath[0], str_replace('-', '/', $detailsPath[1]), $value); - self::handleSetHistory($_fullpath,$_value); + self::handleSetHistory($_fullpath, $_value); } public static function setPolling($_nodeId, $_cc, $_endpoint, $_property, $_value) { @@ -1040,11 +1039,11 @@ public static function handleSetHistory($_fullpath, $_value) { $endpoint = $elements[2]; $property = $elements[3]; $logical = $class . '-' . $endpoint . '-' . $property; - if (in_array($class,array('112','132','99'))){ - $waiting = $eqLogic->getCache('waiting',array()); - $waiting[$logical] = array('value'=>$_value,'date'=>date("d/m/Y H:i:s")); + if (in_array($class, array('112', '132', '99'))) { + $waiting = $eqLogic->getCache('waiting', array()); + $waiting[$logical] = array('value' => $_value, 'date' => date("d/m/Y H:i:s")); log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $logical . ' ' . $_value); - $eqLogic->setCache('waiting',$waiting); + $eqLogic->setCache('waiting', $waiting); } } } @@ -1110,27 +1109,27 @@ public static function inclusion($_method, $_options) { $args['type'] = 'inclusion'; self::publishMqttApi($api, $args); } - + public static function grantSecurity($_security, $_auth) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . __('Grant Security', __FILE__) . ' ' . $_security . ' ' . $_auth); $auth = false; $security = array(); - if ($_auth != "false"){ + if ($_auth != "false") { $auth = true; } foreach ($_security as $class) { - $security[]= intval($class); + $security[] = intval($class); } $args = array('args' => array(array('securityClasses' => $security, 'clientSideAuth' => $auth))); self::publishMqttApi('grantSecurityClasses', $args); } - + public static function validateDSK($_dsk) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . __('Validation DSK', __FILE__) . ' ' . $_dsk); $args = array('args' => array($_dsk)); self::publishMqttApi('validateDSK', $args); } - + public static function abortInclusion() { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . __('Annulation Inclusion', __FILE__)); $args = array(); @@ -1209,7 +1208,7 @@ public static function createEqLogic($_node, $_ignoreEvent = false) { public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { $nodeValuesDict = array(); $eqLogic = self::byLogicalId($_nodeId, __CLASS__); - $waiting = $eqLogic->getCache('waiting',array()); + $waiting = $eqLogic->getCache('waiting', array()); $nodeValues = '
'; foreach ($_values as $key => $value) { $value['oriKey'] = $key; @@ -1241,7 +1240,7 @@ public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { $nodeValues .= '' . $data['property'] . ''; $prop = $data['property']; } - $globProperty=$cc.'-'.$data['endpoint'].'-'.$prop; + $globProperty = $cc . '-' . $data['endpoint'] . '-' . $prop; if (isset($data['description'])) { $nodeValues .= '' . $data['label'] . ' '; } else { @@ -1249,10 +1248,10 @@ public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { } $nodeValues .= ''; $waitingValue = ''; - if (isset($waiting[$globProperty])){ - if ($waiting[$globProperty]['value'] == $data['value']){ + if (isset($waiting[$globProperty])) { + if ($waiting[$globProperty]['value'] == $data['value']) { unset($waiting[$globProperty]); - $eqLogic->setCache('waiting',$waiting); + $eqLogic->setCache('waiting', $waiting); } else { $waitingValue = $waiting[$globProperty]['value']; } @@ -1324,8 +1323,8 @@ public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { if ($tooltip != '') { $span .= ' '; } - if ($waitingValue != ''){ - $span.=' '.$waitingValue.''; + if ($waitingValue != '') { + $span .= ' ' . $waitingValue . ''; } $updates[str_replace(' ', '_', $data['id'])] = array('value' => $span); $nodeValues .= '' . $span . ''; @@ -1371,7 +1370,7 @@ public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { $nodeValues .= ' data-type="' . $data['type'] . '"'; $nodeValues .= ' data-label="' . $data['label'] . '"'; $nodeValues .= ' data-path="' . $data['id'] . '"'; - if (isset($data['unit'])){ + if (isset($data['unit'])) { $nodeValues .= ' data-unit="' . $data['unit'] . '"'; } else { $nodeValues .= ' data-unit=""'; @@ -1386,7 +1385,7 @@ public static function constructValuePage($_nodeId, $_values, $_nodeStatus) { $nodeValues .= ' data-type="' . $data['type'] . '"'; $nodeValues .= ' data-label="' . $data['label'] . '"'; $nodeValues .= ' data-path="' . $data['id'] . '"'; - if (isset($data['unit'])){ + if (isset($data['unit'])) { $nodeValues .= ' data-unit="' . $data['unit'] . '"'; } else { $nodeValues .= ' data-unit=""'; @@ -1472,7 +1471,7 @@ public static function constructHealthPage($_values, $_mobile = False) { $polling = '' . $numberPoll . ''; } $healthPage .= '' . $polling . ''; - + $numberRefresh = 0; if (is_object($eqLogic)) { $refreshes = $eqLogic->getConfiguration('refreshes', array()); @@ -1527,16 +1526,16 @@ public static function constructHealthPage($_values, $_mobile = False) { } else { $next = self::secondsToTime($values['values']['132-0-wakeUpInterval']['value'] - $wakedup); } - if ($wakedup > 3*$values['values']['132-0-wakeUpInterval']['value']) { + if ($wakedup > 3 * $values['values']['132-0-wakeUpInterval']['value']) { $action = '' . __('Equipement', __FILE__) . ''; - if (config::byKey('notifyMissWakeup', __CLASS__, 1)==1 && $eqLogic->getIsEnable()==1){ - if (version_compare(jeedom::version(),'4.4.0','>=')){ - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ", ne s'est pas reveillé au moins 4 fois. Il a peut être un problème (batterie ou autres).", $action,'Wakeup-'.$eqLogic->getLogicalId(),true,'alertingReturnBack'); + if (config::byKey('notifyMissWakeup', __CLASS__, 1) == 1 && $eqLogic->getIsEnable() == 1) { + if (version_compare(jeedom::version(), '4.4.0', '>=')) { + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ", ne s'est pas reveillé au moins 4 fois. Il a peut être un problème (batterie ou autres).", $action, 'Wakeup-' . $eqLogic->getLogicalId(), true, 'alertingReturnBack'); } else { - message::add('zwavejs',"L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId(). ", ne s'est pas reveillé au moins 4 fois. Il a peut être un problème (batterie ou autres).", $action,'Wakeup-'.$eqLogic->getLogicalId(),true); + message::add('zwavejs', "L'équipement : " . $eqLogic->getHumanName(true) . ' avec le nodeId : ' . $eqLogic->getLogicalId() . ", ne s'est pas reveillé au moins 4 fois. Il a peut être un problème (batterie ou autres).", $action, 'Wakeup-' . $eqLogic->getLogicalId(), true); } } - $eqLogic->setConfiguration('missedWakeup',true); + $eqLogic->setConfiguration('missedWakeup', true); $eqLogic->save(); } $healthPage .= '
' . $next . ''; @@ -1696,25 +1695,26 @@ public static function autoCreateCommandAction($_path, $_type, $_label, $_unit, } } } - + public static function getWaiting() { $globWaiting = array(); foreach (self::byType(__CLASS__) as $eqLogic) { - $waitings = $eqLogic->getCache('waiting',array()); + $waitings = $eqLogic->getCache('waiting', array()); if (is_object($eqLogic)) { $image = 'plugins/zwavejs/core/config/devices/' . $eqLogic->getImgFilePath(); if (!is_file(dirname(__FILE__) . '/../config/devices/' . $eqLogic->getImgFilePath())) { $image = 'plugins/zwavejs/plugin_info/zwavejs_icon.png'; } - foreach ($waitings as $property=>$data){ - $globWaiting[] = array('id'=>$eqLogic->getLogicalId(), - 'eqId'=>$eqLogic->getId(), - 'image'=>$image, - 'name'=>$eqLogic->getHumanName(true), - 'property'=>$property, - 'value'=>$data['value'], - 'date'=>$data['date'] - ); + foreach ($waitings as $property => $data) { + $globWaiting[] = array( + 'id' => $eqLogic->getLogicalId(), + 'eqId' => $eqLogic->getId(), + 'image' => $image, + 'name' => $eqLogic->getHumanName(true), + 'property' => $property, + 'value' => $data['value'], + 'date' => $data['date'] + ); } } } @@ -1744,17 +1744,17 @@ public function handleCommandUpdate($_change, $_init = false) { $this->updateCmd($cmdId, $_change['newValue']); } } - + public function handleNotificationUpdate($_change, $_cc) { // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . 'Notification pour le node ' . $this->getHumanName()); // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $this->getHumanName() . ' ' . json_encode($_change) . ' sur la CC ' . $_cc); - foreach ($_change as $key => $value){ + foreach ($_change as $key => $value) { if ($key == 'parameters') { - foreach ($value as $keyparam => $valueparam){ - $this->updateCmd($_cc.'-'.'0-notification-'.$key.'-'.$keyparam, $valueparam); + foreach ($value as $keyparam => $valueparam) { + $this->updateCmd($_cc . '-' . '0-notification-' . $key . '-' . $keyparam, $valueparam); } } else { - $this->updateCmd($_cc.'-'.'0-notification-'.$key, $value); + $this->updateCmd($_cc . '-' . '0-notification-' . $key, $value); } } } @@ -1765,7 +1765,7 @@ public function updateCmd($_cmdId, $_value) { "Air_temperature" => "Air temperature" ); //log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $_cmdId . ' ' . $_value); - $waiting = $this->getCache('waiting',array()); + $waiting = $this->getCache('waiting', array()); $_cmdId = str_replace('_', ' ', $_cmdId); $cmdId = explode('-', $_cmdId, 3); $class = $cmdId[0]; @@ -1811,10 +1811,10 @@ public function updateCmd($_cmdId, $_value) { // log::add(__CLASS__, 'debug', $label); $this->checkAndUpdateCmd($_cmdId . '-label', $label); } - if (isset($waiting[$_cmdId])){ - if ($waiting[$_cmdId]['value'] == $_value){ + if (isset($waiting[$_cmdId])) { + if ($waiting[$_cmdId]['value'] == $_value) { unset($waiting[$_cmdId]); - $this->setCache('waiting',$waiting); + $this->setCache('waiting', $waiting); } } } @@ -1962,7 +1962,7 @@ public function handleProperties($_device) { $command['name'] = $details['name']; } if (isset($details['filterVisible'])) { - if (in_array($command['name'],$details['filterVisible']['commands'])){ + if (in_array($command['name'], $details['filterVisible']['commands'])) { $command['isVisible'] = $details['filterVisible']['value']; } } @@ -2064,8 +2064,8 @@ public function getEqLogicInfos() { $result = array(); $result['interview'] = $this->getConfiguration('interview', false); $command_counter = 0; - foreach ($this->getCmd() as $cmd){ - if (!in_array($cmd->getLogicalId(),array('0-0-nodeStatus','0-0-pingNode','0-0-healNode','0-0-isFailedNode'))){ + foreach ($this->getCmd() as $cmd) { + if (!in_array($cmd->getLogicalId(), array('0-0-nodeStatus', '0-0-pingNode', '0-0-healNode', '0-0-isFailedNode'))) { $command_counter += 1; } } @@ -2240,25 +2240,24 @@ public function createCommand($_update = 0) { public function pollValue($_class) { // log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $_class); - if (stripos($_class,'-value-') === false) { + if (stripos($_class, '-value-') === false) { $command = explode('-', $_class, 3); $args = array('args' => array(array('nodeId' => intval($this->getLogicalId()), 'commandClass' => intval($command[1]), 'endpoint' => intval($command[0]), 'property' => $command[2]))); - } - else { + } else { $command = explode('-', $_class, 4); - $args = array('args' => array(array('nodeId' => intval($this->getLogicalId()), 'commandClass' => intval($command[1]), 'endpoint' => intval($command[0]), 'property' => $command[2], 'propertyKey' => intval($command[3])))); + $args = array('args' => array(array('nodeId' => intval($this->getLogicalId()), 'commandClass' => intval($command[1]), 'endpoint' => intval($command[0]), 'property' => $command[2], 'propertyKey' => intval($command[3])))); } log::add(__CLASS__, 'debug', $this->getHumanName() . '[' . __FUNCTION__ . '] ' . json_encode($args)); self::publishMqttApi('pollValue', $args); } - - public function refreshIfNeeded($_path,$_value) { + + public function refreshIfNeeded($_path, $_value) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] ' . $_path . ' ' . $_value); $refreshes = $this->getConfiguration('refreshes', ''); - if (is_array($refreshes) && count($refreshes) >0 ) { + if (is_array($refreshes) && count($refreshes) > 0) { foreach ($refreshes as $refresh) { $source = $refresh['refresh::source']; - if (strpos(str_replace('/','-',$_path).'-'.$_value,$source) !== false){ + if (strpos(str_replace('/', '-', $_path) . '-' . $_value, $source) !== false) { log::add(__CLASS__, 'debug', '[' . __FUNCTION__ . '] Found refresh'); $cmd = 'php ' . dirname(__FILE__) . '/../../core/php/refresher.php id=' . $this->getId(); $cmd .= ' target=' . $refresh['refresh::target'] . ''; @@ -2324,7 +2323,7 @@ public function execute($_options = array()) { return; } if ($property == 'refreshNodeCC') { - zwavejs::refreshNodeCC(intval($node),intval($cc)); + zwavejs::refreshNodeCC(intval($node), intval($cc)); return; } if ($cc == 0 && $endpoint == 0) { @@ -2361,6 +2360,6 @@ public function execute($_options = array()) { return; } zwavejs::publishMqttValue($node, $path, $value); - $eqLogic->refreshIfNeeded($path,$value); + $eqLogic->refreshIfNeeded($path, $value); } } diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 589139e0..ffd2f95f 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,9 +4,13 @@ > >S'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte. +# 15/11/2024 + +- Correction de la méthode d'installation des dépendances + # 27/09/2024 -- Changement des versions minimum, core 4.4 et OS Debian 11 minimum +- Changement des versions minimales: core 4.4 et OS Debian 11 # 26/09/2024 @@ -36,9 +40,9 @@ **Ajouts de Configurations** - Ajout de la configuration *Neo Signal Repeater* (propriétés : Temperature, Humidity) -- Ajout de la configuration *Shelly Qubino Wave 1* (propriétés : Switch, Notification Mains, Notification Over-Current, Notification Heat-Sensor) +- Ajout de la configuration *Shelly Qubino Wave 1* (propriétés : Switch, Notification Mains, Notification Over-Current, Notification Heat-Sensor) - Ajout de la configuration *Shelly Qubino Wave 1 PM* (propriétés : Switch, Power, Energy, Notification Mains, Notification Over-Current, Notification Heat-Sensor) -- Ajout de la configuration *Shelly Qubino Wave Pro 1* (propriétés : Switch, Notification Mains, Notification Heat-Sensor) +- Ajout de la configuration *Shelly Qubino Wave Pro 1* (propriétés : Switch, Notification Mains, Notification Heat-Sensor) - Ajout de la configuration *Shelly Qubino Wave Pro 1 PM* (propriétés : Switch, Power, Energy, Notification Mains, Notification Over-Current, Notification Over-Voltage, Notification Heat-Sensor) - Ajout de la configuration *Shelly Qubino Wave 2 PM* (propriétés : Switch, Power, Energy, Notification Mains, Notification Over-Current, Notification Heat-Sensor) - Ajout de la configuration *Shelly Qubino Wave Pro 2* (propriétés : Switch) @@ -67,7 +71,7 @@ **Améliorations** - Rajout d'une option permettant d'activer ou désactiver le *Soft Reset* -- Passage à la version *9.6.2* de ZwaveJsUI +- Passage à la version *9.6.2* de ZwaveJsUI **Ajouts de Configurations** diff --git a/plugin_info/packages.json b/plugin_info/packages.json index 9d5353fd..046f707c 100644 --- a/plugin_info/packages.json +++ b/plugin_info/packages.json @@ -1,17 +1,14 @@ { - "plugin" : { - "mqtt2" : {} + "plugin": { + "mqtt2": {} }, - "apt":{ - "nodejs" : {} + "apt": { + "nodejs": {} }, - "npm": { - "yarn": {} + "pre-install": { + "script": "plugins/zwavejs/resources/pre_install.sh" }, - "pre-install" : { - "script" : "plugins/zwavejs/resources/pre_install.sh" - }, - "post-install" : { - "script" : "plugins/zwavejs/resources/post_install.sh" + "post-install": { + "script": "plugins/zwavejs/resources/post_install.sh" } } diff --git a/resources/post_install.sh b/resources/post_install.sh index bdcabaa0..7e7ffffd 100644 --- a/resources/post_install.sh +++ b/resources/post_install.sh @@ -7,8 +7,8 @@ BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) cd $BASEDIR cd zwave-js-ui -sudo yarn install -sudo yarn run build +sudo npm install +sudo npm run build chown -R www-data:www-data * if [ -e /dev/ttyAMA0 ]; then @@ -36,5 +36,4 @@ then echo "And reboot your Raspberry Pi" fi fi -echo "Everything is successfully installed!" - +echo "Everything is successfully installed!" \ No newline at end of file