if ($ms->config['MS_SERIAL']) {
        $ser = $ms->config['MS_SERIAL'];
    }
    $ms_client = new MySensorMasterCom($ser);
} else {
    require "./modules/mysensor/phpMSTcp.php";
    $host = 'localhost';
    if ($ms->config['MS_HOST']) {
        $host = $ms->config['MS_HOST'];
    }
    if ($ms->config['MS_PORT']) {
        $port = $ms->config['MS_PORT'];
    } else {
        $port = 5003;
    }
    $ms_client = new MySensorMasterTcp($host, $port);
}
if (!$ms_client->connect()) {
    exit(1);
}
$params = array("presentation" => "doPresentation", "set" => "doSet", "req" => "doReq", "internal" => "doInternal");
$ms_client->subscribe($params);
//=== Req values ===
$rec = SQLSelect("SELECT * FROM msnodeval WHERE req=1;");
$total = count($rec);
if ($total) {
    for ($i = 0; $i < $total; $i++) {
        $ms->cmd($rec[$i]['NID'] . ";" . $rec[$i]['SID'] . ";2;" . $rec[$i]['ACK'] . ";" . $rec[$i]['SUBTYPE'] . ";");
    }
}
//== Cycle ===