Open Roehrenkramladen opened 3 years ago
Hi Roehrenkramladen, interesting documentation, love the considerations you took, like using the relay :) Using the Wifi configurator is also a nice touch I wanted to do for quite a while. I would love if you could commit it as a push request here on Github if you can.
For your problem: I'm not 100% sure if I get it right. So what I think you are asking is if there is a way not not hard-code the user-info to the Fritz!Box, but have it added just like the Wifi password in your case.
The only thing that prevents you from this, is that the line
TR064 connection(PORT, IP, fuser, fpass);
is in the definition area right now, instead of the main loop. But you can just move that to the main loop, so something like (pseudocode):
Hallo,
ich habe deinen Vorschlag mal getestet. Leider funktioniert es nicht. Der ESP8266 stürzt ab. Der Login ins Wifi funktioniert, wenn er aber die TR064 Verbindung startet stürzt die Software ab. Auslöser ist der "init Prozess". Der blockiert den ESP8266 zu lange, der löst dann WDT (Wachdog Timeout) aus. Führt man das ganze aus wenn im Hintergrund des ESP noch keine Verbindung aktiv funktioniert es einwand frei. D.h. TR064 connection(PORT, IP, fuser, fpass); muss ausgeführt werden bevor die Wifi Verbindung steht. Deshalb steht sie in den Beispielen im "Definition Bereich".
Danke!
Ok, kannst du auch den entsprechenden Code posten?
Welches Debug-Level benutzt du?
Also ich wüsste keinen Grund, warum die TR-064 Verbindung zuerst aufgebaut werden müsste. Aber falls das wirklich so ist (wäre dann interessant warum), dann könntest du halt auch einfach die Fragen umkehren (also erst Router-Einstellungen und dann WIFI). Dann ist nur das Problem, dass du dem Nutzer nicht mitteilen kannst, wenn er sich bei den Router Einstellungen vertippt hat.
Hallo,
anbei der Code der den Absturz auslöst,. ,Der Befehl in Zeile 90 tr064_connection.init(); löst den Absturz aus.
If you are using the latest version of the library, you should be able to simply leave that line out, maybe try that.
Moin Roehrenkramladen, hast du mal versucht die Zeile auszulassen?
@Roehrenkramladen said in #36
Hallo,
habe es probiert, ohne Init kommt keine TR064 Verbindung zustande. Die Plazierung der Logindaten im Header ist kontraproduktiv. Das verhindert die Übergabe von Daten durch eine Eingabe. Man ist immer auf die hardcodierten Daten angewiesen.
Ok, bist du sicher, dass du die neuste Version der Bibliothek benutzt?
Hi/Moin @Roehrenkramladen, I just merged an important bug-fix. Can you see if it works for you now, using version 1.2.1? Or did you solve it in the meantime? How?
Ich habe gerade einen Bugfix gemerged, kannst du testen ob es mit der neuen Version (1.2.1) funktioniert? Oder hast Du es in der Zwischenzeit anderweitig gelöst? Wie?
Hi @Aypac, I was facing the same issue that was brought up by @Roehrenkramladen when building an Sketch for ESP8266.
Even with the new library 1.2.1 the following code will not work for me:
`... char FritzBoxIp = "192.168.178.1; char Password = "TestUser"; char* User = "Password"; ...
void loop() {
TR064 connection(FRITZBOX_PORT, FritzBoxIp, User, Password);
connection.init();
...
connection.action (.......)
}
`
But I got it working like this: `... char FritzBoxIp = "192.168.178.1; char Password = "TestUser"; char* User = "Password";
TR064 connection; ...
void loop() {
connection.setServer(FRITZBOX_PORT, FritzBoxIp, User, Password);
connection.init();
...
connection.action (.......)
}`
if i may.
TR064 connection(FRITZBOX_PORT, FRITZBOXIP, USER, PASSWORD);
Or
TR064 connection; // you will need to set the Parameter later with connection.setServer(…)_
These are the calls to the constructors. You get an instance of the TR064 class. This call should be done only once (dont put this in loop()) and is in the configuration under the variables, because "connection" is the variable of the TR064.
connection.setServer(FRITZBOX_PORT, FRITZBOX_IP, USER, PASSWORD);
Set the Parameter if you use the empty Constructor.
init() **The init() method establishes the connection to the FritzBox. Necessary for this is a network connection.
state() With if(connection.state()<0) the connection to the FritzBox can be checked and if necessary restored by calling init() again.**
String USER = ""; String PASSWORD = ""; String FRITZBOX_IP = "192.168.178.1"; int FRITZBOX_PORT = 49000;
TR064 tr064_connection(FRITZBOX_PORT, FRITZBOX_IP, USER, PASSWORD); void setup(){
}
void loop() {
if(connection.state()<0){
connection.init();
}
}
String USER = ""; String PASSWORD = ""; String FRITZBOX_IP = "192.168.178.1"; int FRITZBOX_PORT = 49000;
TR064 tr064_connection;
void setup(){
connection.setServer(FRITZBOX_PORT, FRITZBOX_IP, USER, PASSWORD);
}
void loop() {
if(connection.state()<0){
connection.init();
}
}
Thanks @saak2820 ! Did it solve your problem @spekulatius-fb ?
Hallo,
I used your library to build my wifi bell. Thanks for the publication! I have documented everything here including the hardware: http://www.roehrenkramladen.de/Tuerklingel-V2/TK-FB-V2-1.html I use the wifi manager to configure the wifi data. I could also query the TR064 data (user & password) with the wifi manager, but it doesn't work because the parameters for the Fritzbox user are transferred in the main area. Does anyone know a solution? Thank you in advance for your answers!
thanks