nodo-domotica.nl http://www.nodo-domotica.nl/forum/ |
|
Nodo wel via www maar niet lokaal te verbinden http://www.nodo-domotica.nl/forum/viewtopic.php?f=36&t=1887 |
Pagina 1 van 2 Volgende » |
Auteur: | hansbemelen [ 03 jan 2014, 16:32 ] |
Titel: | Nodo wel via www maar niet lokaal te verbinden |
Via de webapp is mijn Nodo te bereiken en lijkt geheel te werken kan nu als test een kaku schakelen. Via de uitleg en goede hulp van Willem Aandewiel heb ik de webapp ook lokaal draaien. Verbinden gaat alleen lokaal niet want dan komt de popup: Authentication failed! Does the Nodo password and Nodo ID match your Nodo? Op de lokale server staat alles goed in de DB wat betreft ip nummer, poort, Nodo ID en password?? Wie weet een oplossing? |
Auteur: | rtenklooster [ 03 jan 2014, 16:48 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Als je in de webapp lokaal inlogt, dan bij configure -> connection dan staat alles goed? Ff opnieuw invullen en auto configure your nodo aanvinken. Even zien wat er dan gebeurt. Anders je mega via serial een reset commando geven. Console openlaten en opnieuw verbinding proberen te maken. Zal toch ergens iets mis gaan. De lokale webapp moet ook wat aanpassingen hebben wbt. httphost e.d. die heb je doorgevoerd? Als je nodo probeert verbinding te maken met de webapp op dit domein gaat het niet lukken. |
Auteur: | hansbemelen [ 03 jan 2014, 17:18 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Beste R ten Klooster, als ik hem via autoconfigure wil laten connecten krijg ik de volgende boodschap: Configuration failed! Please make sure your Nodo has default settings Als ik het vinkje uitzet: Authentication failed! Does the Nodo password and Nodo ID match your Nodo? Ik zie beide keren dat er "verkeer" is met de Nodo maar geen verbinding die opgebouwd wordt door het een of ander wat niet goed staat maar volgens mij staat alles goed en heb tevens ook al gereset. |
Auteur: | rtenklooster [ 03 jan 2014, 17:48 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Kun je na een reset eens een status all commando uitput posten hier? Heb hier geen mega voorhanden, ff zien wat er dan allemaal nog in staat. Met name de build die je gebruikt is wel even interessant. |
Auteur: | hansbemelen [ 03 jan 2014, 18:30 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Hier een stukje waar de build in staat. VariableSet 15,0.00 Build 596 ClientIP 0.0.0.0 ClockDaylight 4,0 ClockSetDate 03-01-2014 ClockSetTime 18:25 Debug Off Plugin 1 Plugin 2 Plugin 3 Plugin 4 EventlistCount 4,252 FreeMem 2345 HTTPHost http://www.nodo-domotica.nl/webapp/nodo.php HWConfig 131809 ID MS4QDKTW IP 192.168.178.29(DHCP) Lock Off Log Off Output HTTP,On Dit is dus via http://www.nodo-domotica.nl/webapp/nodo.php OMDAT er geen verbinding lokaal gemaakt kan worden............ |
Auteur: | rtenklooster [ 03 jan 2014, 21:37 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Post je : webapp\webservice\admin\json_setup_connection.php eens wil je? |
Auteur: | aron [ 04 jan 2014, 07:53 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
je moet je HTTPHost http://www.nodo-domotica.nl/webapp/nodo.php veranderen ![]() |
Auteur: | rtenklooster [ 04 jan 2014, 09:58 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Auteur: | hansbemelen [ 04 jan 2014, 10:25 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Het gevraagde bestand.. wist niet hoe anders te versturen. <?php require_once('../../connections/db_connection.php'); require_once('../../include/auth.php'); require_once('../../include/user_settings.php'); require_once('../../include/webapp_settings.php'); $http_status; //Variable voor de HTTP status code $build; //Functie om het ip-adres van de client te achterhalen function get_ip_address() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'RE$ if (array_key_exists($key, $_SERVER) === true) { foreach (explode(',', $_SERVER[$key]) as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP) !== false) { return $ip; } } } } } //HTTPRequest function output http headers function HTTPRequest($Url){ global $http_status; if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } global $nodo_port; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt($ch, CURLOPT_USERAGENT, "Nodo WebApp"); curl_setopt($ch, CURLOPT_HEADER, 1); } } } } } //HTTPRequest function output http headers function HTTPRequest($Url){ global $http_status; if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } global $nodo_port; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt($ch, CURLOPT_USERAGENT, "Nodo WebApp"); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_PORT, $nodo_port); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $output = curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return $output; } //Functie welke de HTTP headers in een array plaats. Een bepaalde header is op te vragen via bijvoorbeeld $headers=http_parse_headers(HTTPRequest("http://$nodo_ip/?eve$ if (!function_exists('http_parse_headers')) { function http_parse_headers($header) { $retVal = array(); $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header)); foreach ($fields as $field) { if (preg_match('/([^:]+): (.+)/m', $field, $match)) { $match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1]))); if (isset($retVal[$match[1]])) { $retVal[$match[1]] = array($retVal[$match[1]], $match[2]); } else { $retVal[$match[1]] = trim($match[2]); } } } return $retVal; } } function trim_br($string){ //Deletes empty spaces and br tags on start and end of a string $string = preg_replace('/^\s*(?:<br\s*\/?>\s*)*/i', '', $string); $string = preg_replace('/\s*(?:<br\s*\/?>\s*)*$/i', '', $string); return $string; } function get_phrase_after_string($haystack,$needle) // voorbeelden: // $Build=get_phrase_after_string($script,'Build '); // $OutputHTTP=get_phrase_after_string($script,'Output HTTP,'); // $HTTPHost=get_phrase_after_string($script,'HTTPHost '); { //length of needle $len = strlen($needle); //matches $needle until hits a \n or \r if(preg_match("#$needle([^\r\n]+)#i", $haystack, $match)) { //length of matched text $rsp = strlen($match[0]); //determine what to remove $back = $rsp - $len; return trim(substr($match[0],- $back)); } } if (isset($_POST['save'])) { $nodo_ip = mysql_real_escape_string(htmlspecialchars($_POST['nodo_ip'])); $nodo_port = mysql_real_escape_string(htmlspecialchars($_POST['nodo_port'])); $send_method = mysql_real_escape_string(htmlspecialchars($_POST['send_method'])); $nodo_password = mysql_real_escape_string(htmlspecialchars($_POST['nodo_password'])); //Connectie controleren.. optie om de Nodo automatisch te configureren if (isset($_POST['auto_config'])){ global $build; //Connectie controleren van een standaard Nodo $httpresponse=HTTPRequest("http://$nodo_ip/?event=status%20NodoIp"); $headers=http_parse_headers($httpresponse); $build=trim(substr(strrchr($headers['Server'], "="), 1)); $build=(int)$build; } else { //Connectie controleren global $build; //Connectie controleren van een standaard Nodo $httpresponse=HTTPRequest("http://$nodo_ip/?event=status%20NodoIp"); $headers=http_parse_headers($httpresponse); $build=trim(substr(strrchr($headers['Server'], "="), 1)); $build=(int)$build; } else { //Connectie controleren global $build; //Connectie controleren van een standaard Nodo $httpresponse=HTTPRequest("http://$nodo_ip/?event=status%20NodoIp"); $headers=http_parse_headers($httpresponse); $build=trim(substr(strrchr($headers['Server'], "="), 1)); $build=(int)$build; $key = md5($cookie.":".$nodo_password); //key opnieuw genereren omdat we het wachtwoord nog niet in de DB hebben opgeslagen if ($build >= 517) { $HTTPHost=get_phrase_after_string(trim_br(HTTPRequest("http://$nodo_ip/?event=status%20HTTPHost&key=$key")),'HTTPHost '); $OutputHTTP=get_phrase_after_string(trim_br(HTTPRequest("http://$nodo_ip/?event=status%20Output%20HTTP&key=$key")),'Output HTTP,'); $headers=http_parse_headers(HTTPRequest("http://$nodo_ip/?event=status%20NodoIp&key=$key")); } else { HTTPRequest("http://$nodo_ip/?event=Filelog%20concheck;status%20HTTPHost;status%20Output%20HTTP;Filelog&key=$key"); $httpresponse=HTTPRequest("http://$nodo_ip/?file=concheck&key=$key"); HTTPRequest("http://$nodo_ip/?event=FileErase%20concheck&key=$key"); $headers=http_parse_headers($httpresponse); $HTTPHost=get_phrase_after_string($httpresponse,'HTTPHost '); $OutputHTTP=get_phrase_after_string($httpresponse,'Output HTTP,'); } } //Controle of een verbinding met een Nodo hebben if ($http_status == '200' && strpos($headers['Server'], 'Nodo/') !== false) { //Controle of de configuratie van de Nodo correct is if ($HTTPHost == "192.168.178.23/webapp/nodo.php" && $OutputHTTP== "On" ) { $response = "1"; } else { $response = "2"; } if (isset($_POST['auto_config'])){ global $build; //Configureer de Nodo HTTPRequest("http://$nodo_ip/?event=eventlistwrite;WildCard%20RF,All;SendEvent%20HTTP"); HTTPRequest("http://$nodo_ip/?event=eventlistwrite;WildCard%20IR,All;SendEvent%20HTTP"); HTTPRequest("http://$nodo_ip/?event=eventlistwrite;WildCard%20Variables,All;SendEvent%20HTTP"); HTTPRequest("http://$nodo_ip/?event=eventlistwrite;WildCard%20Wired,All;SendEvent%20HTTP"); HTTPRequest("http://$nodo_ip/?event=eventlistwrite;EventListWrite;Wildcard%20ALL,UserEvent;SendEvent%20HTTP"); HTTPRequest("http://$nodo_ip/?event=HTTPHost%20$WEBAPP_HOST/nodo.php"); if ($build < 517) { HTTPRequest("http://$nodo_ip/?event=Filewrite%20waconfig"); HTTPRequest("http://$nodo_ip/?event=ok"); HTTPRequest("http://$nodo_ip/?event=Filewrite"); } //Clock gelijk zetten //$year_par1 = substr(date("Y"), 0, 2); //$year_par2 = substr(date("Y"), 2, 2); //$date_par1 = date("j"); //$date_par2 = date("n"); //$time_par1 = date("G"); //$time_par2 = 1*date("i"); //*1 zorgt ervoor dat de voorloop nul wegvalt. //$dow_par1 = date("w")+1; // php zondag = 0 Nodo gaat uit van 1 if ($build < 517) { HTTPRequest("http://$nodo_ip/?event=FileLog%20$file"); } //HTTPRequest("http://$nodo_ip/?event=ClockSetYear%20$year_par1,$year_par2"); //HTTPRequest("http://$nodo_ip/?event=ClockSetDate%20$date_par1,$date_par2"); //HTTPRequest("http://$nodo_ip/?event=ClockSetTime%20$time_par1,$time_par2"); //HTTPRequest("http://$nodo_ip/?event=ClockSetDow%20$dow_par1"); if ($build >= 517) { HTTPRequest("http://$nodo_ip/?event=output%20http,on"); $HTTPHost=get_phrase_after_string(trim_br(HTTPRequest("http://$nodo_ip/?event=status%20HTTPHost&key=$key")),'HTTPHost '); $OutputHTTP=get_phrase_after_string(trim_br(HTTPRequest("http://$nodo_ip/?event=status%20Output%20HTTP&key=$key")),'Output HTTP,'); //Controle of de configuratie van de Nodo correct is if ($HTTPHost == "192.168.178.23/webapp/nodo.php" && $OutputHTTP== "On" ) { $response = "6"; HTTPRequest("http://$nodo_ip/?event=id%20$nodo_id;password%20$nodo_password;SettingsSave;reboot"); } else { $response = "7"; } } else { if (strpos(HTTPRequest("http://$nodo_ip/?file=waconfig"), 'ok') !== false) { global $build; if ($build >= 443 && $build < 455) { // vanaf build 443 HTTPRequest("http://$nodo_ip/?event=id%20$nodo_id;password%20$nodo_password;fileerase%20waconfig;Output%20HTTP,on;reboo$ } elseif ($build >= 455) { //vanaf build 455 HTTPRequest("http://$nodo_ip/?event=id%20$nodo_id;password%20$nodo_password;fileerase%20waconfig;Output%20HTTP,on;Setti$ } else { HTTPRequest("http://$nodo_ip/?event=id%20$nodo_id;password%20$nodo_password;fileerase%20waconfig;OutputIp%20HTTP,on;reb$ } $response = "6"; } else { $response = "7"; } } } } else { $response = "3"; } if ($http_status == '403' && strpos($headers['Server'], 'Nodo/') !== false) { if (isset($_POST['auto_config'])){ $response = "5"; } else{ $response = "4"; } } //Gegevens opslaan in de database mysql_select_db($database, $db); mysql_query("UPDATE nodo_tbl_users SET nodo_ip='$nodo_ip', nodo_port='$nodo_port', send_method='$send_method', nodo_password='$nodo_password' WHERE id='$userI$ $rowsarray[] = array( "response" => $response); $json = json_encode($rowsarray); echo '{"connection":'. $json .'}'; } else { mysql_select_db($database, $db); $result = mysql_query("SELECT * FROM nodo_tbl_users WHERE id='$userId'") or die(mysql_error()); $row = mysql_fetch_array($result); //Indien er al een IP-adres in de database bekend is gebruiken we deze. if ($row['nodo_ip'] != "") { $nodo_ip = $row['nodo_ip']; $nodo_ip_message = ""; } else //Indien er geen IP-adres of hostname is ingevoerd dan vullen we het IP-adres van de client in { $nodo_ip = get_ip_address(); $nodo_ip_message = "Your IP-address is automatically filled. <br \>Make sure that your Nodo can be reached on this IP-address.<br \><br \>"; } $rowsarray[] = array( "nodoid" => $row['nodo_id'], "nodoip" => $nodo_ip, "nodoipmsg" => $nodo_ip_message, "nodoport" => $row['nodo_port'], "nodopassword" => $row['nodo_password']); $json = json_encode($rowsarray); echo '{"connection":'. $json .'}'; } ?> |
Auteur: | rtenklooster [ 04 jan 2014, 11:32 ] |
Titel: | Re: Nodo wel via www maar niet lokaal te verbinden |
Pagina 1 van 2 | Alle tijden zijn GMT + 1 uur |
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/ |