diff --git a/core/class/AbeilleCmdProcess.class.php b/core/class/AbeilleCmdProcess.class.php index 048d569615..49bec769c6 100755 --- a/core/class/AbeilleCmdProcess.class.php +++ b/core/class/AbeilleCmdProcess.class.php @@ -2512,7 +2512,8 @@ function processCmd($Command) { $extPanId = $Command['extPanId']; cmdLog('debug', " zgSetExtendedPanId: extPanId=${extPanId}"); - // WARNING: This does not work. Network must not be running to change ext Pan ID but how to do that ?? + /* Note: This is NOT FUNCTIONAL. + Zigate always answers 04/busy. Probably because network started automatically */ $this->addCmdToQueue2(PRIO_NORM, $dest, $zgCmd, $extPanId, "0000"); return; diff --git a/core/class/AbeilleCmdQueue.class.php b/core/class/AbeilleCmdQueue.class.php index 161955a885..1a4bd3ae74 100755 --- a/core/class/AbeilleCmdQueue.class.php +++ b/core/class/AbeilleCmdQueue.class.php @@ -595,6 +595,8 @@ function processCmdQueues() { $GLOBALS['zigates'][$zgId]['cmdQueue'][$priority][$sendIdx]['sentTime'] = time(); $GLOBALS['zigates'][$zgId]['cmdQueue'][$priority][$sendIdx]['try']--; $GLOBALS['zigates'][$zgId]['tp_time'] = microtime(true) + 0.1; // Next avail time in 100ms + if ($cmd['cmd'] == "0011") // Special case: soft reset + $GLOBALS['zigates'][$zgId]['availTime'] = microtime(true) + 1.0; // Zg will be free in 1sec if (isset($GLOBALS["dbgMonitorAddr"]) && ($cmd['addr'] != "") && ($GLOBALS["dbgMonitorAddr"] != "") && !strncasecmp($cmd['addr'], $GLOBALS["dbgMonitorAddr"], 4)) monMsgToZigate($cmd['addr'], $cmd['cmd'].'-'.$cmd['datas']); // Monitor this addr ? diff --git a/core/php/AbeilleCmd.php b/core/php/AbeilleCmd.php index 3dd30e3a40..2f19bd741f 100644 --- a/core/php/AbeilleCmd.php +++ b/core/php/AbeilleCmd.php @@ -175,33 +175,46 @@ function configureZigate($zgId) { return; } - msgToCmd("CmdAbeille".$zgId."/0000/zgSoftReset", ""); + // msgToCmd("CmdAbeille".$zgId."/0000/zgSoftReset", ""); + AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0011", "", "0000", null); // Following cmds delayed by 1sec to wait for chip reset // Extended PAN ID change must be done BEFORE starting network - msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetExtendedPanId&tempo=".(time()+1), "extPanId=21758D1900481200"); + // Note: STILL NOT FUNCTIONAL. Zigate always says "BUSY" !!! Network seems to be automatically started after soft reset even without 0024/Start cmd. + // Note: Experiement was done for Livolo TI0001 case with channel 26 and specific EPANID + // msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetExtendedPanId&tempo=".(time()+1), "extPanId=21758D1900481200"); + // AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0020", "21758D1900481200", "0000", null); global $config; - if (isset($config['ab::gtwChan'.$zgId])) { - $chan = $config['ab::gtwChan'.$zgId]; - if ($chan == 0) - $mask = 0x7fff800; // All channels = auto - else - $mask = 1 << $chan; - $mask = sprintf("%08X", $mask); - cmdLog('debug', " Settings chan ".$chan." (mask=".$mask.") for zigate ".$zgId); - msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetChannelMask&tempo=".(time()+1), "mask=".$mask); - } - msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetTimeServer&tempo=".(time()+1), ""); + $chan = isset($config['ab::gtwChan'.$zgId]) ? $config['ab::gtwChan'.$zgId] : 0; // Default = auto (all channels) + if ($chan == 0) + $mask = 0x7fff800; // All channels = auto + else + $mask = 1 << $chan; + $mask = sprintf("%08X", $mask); + cmdLog('debug', " Settings chan ".$chan." (mask=".$mask.") for zigate ".$zgId); + // msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetChannelMask&tempo=".(time()+1), "mask=".$mask); + AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0021", $mask, "0000", null); + + // msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetTimeServer&tempo=".(time()+1), ""); + $zgRef = mktime(0, 0, 0, 1, 1, 2000); // 2000-01-01 00:00:00 + $zgTime = time() - $zgRef; + $data = sprintf("%08s", dechex($zgTime)); + AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0016", $data, "0000", null); if (isset($config['ab::forceZigateHybridMode']) && ($config['ab::forceZigateHybridMode'] == "Y")) { $mode = "hybrid"; - } else + $mode2 = "02"; + } else { $mode = "raw"; + $mode2 = "01"; + } cmdLog('debug', " Configuring Zigate ${zgId} in ${mode} mode"); - msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetMode&tempo=".(time()+1), "mode=${mode}"); + // msgToCmd("TempoCmdAbeille".$zgId."/0000/zgSetMode&tempo=".(time()+1), "mode=${mode}"); + AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0002", $mode2, "0000", null); - msgToCmd("TempoCmdAbeille".$zgId."/0000/zgStartNetwork&tempo=".(time()+10), ""); + // msgToCmd("TempoCmdAbeille".$zgId."/0000/zgStartNetwork&tempo=".(time()+10), ""); + AbeilleCmdQueue::pushZigateCmd($zgId, PRIO_HIGH, "0024", "", "0000", null); msgToCmd("TempoCmdAbeille".$zgId."/0000/zgGetVersion&tempo=".(time()+10), ""); } diff --git a/docs/fr_FR/Changelog.md b/docs/fr_FR/Changelog.md index c4ff10b11a..8af525f765 100644 --- a/docs/fr_FR/Changelog.md +++ b/docs/fr_FR/Changelog.md @@ -8,6 +8,7 @@ - Correction: Cmd: Status TX corrigé en 'ok' meme si 'rx OFF when idle'. - Amélioration: Zigate: Tentative d'ajout possibilité de changer 'Extended PAN ID' pour cas Livolo. Ne fonctionne pas ! - Amélioration: Cmd->Zigate: Cas Zigate 'busy'. +- Amélioration: Cmd/config Zigate. ## 240802-BETA-1