FirebaseExtended / firebase-arduino

Arduino samples for Firebase.
Apache License 2.0
945 stars 494 forks source link

NodeMCU 1.0 ESP8266 not connecting to Firebase database? #285

Closed nutc4k3 closed 6 years ago

nutc4k3 commented 6 years ago

Firebase.error() comes empty. Doesn’t change lamp value. Always prints "1" when asked Bool value of lamp.

Here is the branch:

testel-23702: ------lamp: false

Here is the code:

include

include

// Set these to run example.

define FIREBASE_HOST "testel-23702.firebaseio.com"

define FIREBASE_AUTH "LEWg3dqwjHWWHffjsmBNfDsNTVccIEU3CW4eEfLe"

define WIFI_SSID "mywifi"

define WIFI_PASSWORD "mywifipassword"

int hora = 0; float horas = 0;

void setup() { Serial.begin(115200);

// connect to wifi. WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("connecting"); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } delay(1000); Serial.println(); Serial.print("connected: "); Serial.println(WiFi.localIP());

Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); Firebase.setBool("lamp", false); }

void loop() { Serial.println("Enviando dados...."); Firebase.setBool("lamp", true); Serial.println(Firebase.getBool("lamp")); delay (1000);

if (Firebase.failed()) { Serial.print("setting /message failed:"); Serial.println(Firebase.error());
return; } delay(5000); }

spinxsunyi commented 6 years ago

I am exactly got the same problem. My code for NODE MCU that works 3 months ago, now useless. It gives empty error and I don't know why.

spinxsunyi commented 6 years ago

I got the solution! Thanks for @haizen007 from #253 thread.

it's working here! you have to remove your old firebase library (usually in my documents on windows), download and add the new one from master, then you will be able to run your code again!

allistoncarlos commented 6 years ago

I tried that, removed and added again and again, but nothing goes to firebase... I don't even know what the problem is...

amanasmuei commented 6 years ago

same here..any solution ?

lky94 commented 6 years ago

same here looking for solution

freq-0ut commented 6 years ago

same here...

mrunmaydarpan commented 6 years ago

same here

abhinavnishant commented 6 years ago

Not working for me too! :(

aravindkarthik96 commented 6 years ago

I am having the same issue, please help

heriveltogabriel commented 6 years ago

I'm having the same problem, I downloaded it again, updated but it does not work. Someone?

heriveltogabriel commented 6 years ago

Guys, I've been able to solve my problem. I removed the bar "/" from the end of the url

Ex:

define FIREBASE_HOST "test.firebaseio.com"

That's Work!!!

AndhikaBrosnan commented 6 years ago

@heriveltogabriel Are you using the latest Firebase Library?

mrunmaydarpan commented 6 years ago

Yes

mrunmaydarpan commented 6 years ago

Sry. I am using latest library. But still no luck

AndhikaBrosnan commented 6 years ago

@mrunmaydarpan Try include Arduino JSON Library

mrunmaydarpan commented 6 years ago

Ok thanks. I'll try it after some time. Thn I'll let you know the results

aravindkarthik96 commented 6 years ago

@heriveltogabriel yes this works, also had to remove https:// , thanks

heriveltogabriel commented 6 years ago

@aravindkarthik96 , @BrosnanUhYeah Yes, I did downloaded last version and removed the bar "/" from the end of the url and "https:// " too.

Works Perfect!

my url example:

define FIREBASE_HOST "test.firebaseio.com"

axelsilvaferreira commented 6 years ago

Hi, I had the same problem. I was using the wrong token. Apparently you have to go to Firebase "Settings" > "Service Accounts" tab > under Legacy Credentials click "Database Secrets" > select your firebase project anda click "Show". The following video shows how to get the token. youtube

proppy commented 6 years ago

Filed #350 to update the secret documention.

ahmadhanis commented 6 years ago

not working.. kept getting setting /number failed: error tried all off the above..

Foysal0075 commented 5 years ago

If such things happen please remove old firebase master from arduino library, download latest firebase master from github and place it in arduino library folder. Everything will work fine then.

mcxberme commented 5 years ago

I had the same problem, I tried with haizen007 solution but still doesn't work. This is what I made to finally get it. I added a new secret (token) in Firebase Settings, I copied that and pasted in code, that's all and now it's working

bayuleo commented 5 years ago

Thanks haizen007, its work for me.

  1. Download latest library FirebaseArduino https://github.com/firebase/firebase-arduino
  2. Delete old library on C:\Users"\YOUR USER NAME\"\Documents\Arduino\libraries
  3. Add new library (file download step 1) from Arduino IDE. Everything will work fine then :)
troomtech commented 5 years ago

After Updating Firebase Library My Connectivity Problem is Gone

dheec commented 5 years ago

Apparently none of the above solutions are working for me. I tried to include new Arduino master library, tried new database secret key, disabled watchdog, changed fingerprints, added delays...still couldn't connect Nodemcu with google firebase. Here is the part of the code. `

include

include

include

define FIREBASE_HOST "myhome-autoae8e8.firebaseio.com" //Your Firebase Project URL goes here without "http:" , "\" and "/"

define FIREBASE_AUTH "B4g2QQehSW8ZT14bi8pj8HtzXCviNswdE6tNbcvr" //Your Firebase Database Secret goes here

define WIFI_SSID "Tenda" //your WiFi SSID for which yout NodeMCU connects

define WIFI_PASSWORD "**" //Password of your wifi network

define FIREBASE_JSONBUFFER_SIZE JSON_OBJECT_SIZE(128)

define Relay1 D6 //D6 12

int val1;

define Relay2 4 //D2

int val2;

define Relay3 5 //D1

int val3;

define Relay4 14 //D5

int val4;

void setup() { Serial.begin(115200); // Select the same baud rate if you want to see the datas on Serial Monitor ESP.wdtDisable(); // pinMode(Relay1,OUTPUT); // pinMode(Relay2,OUTPUT); // pinMode(Relay3,OUTPUT); // pinMode(Relay4,OUTPUT); // // digitalWrite(Relay1,LOW); //high // digitalWrite(Relay2,LOW); //high // digitalWrite(Relay3,LOW); //high // digitalWrite(Relay4,LOW); //high

WiFi.begin(WIFI_SSID,WIFI_PASSWORD); Serial.print("connecting"); while (WiFi.status()!=WL_CONNECTED){ Serial.print("."); Serial.print("I am getting connected.."); delay(1000); } Serial.println("I am here and connected"); Serial.print("connected:"); Serial.println(WiFi.localIP());

//ESP.wdtDisable(); Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH); delay(10); Firebase.setInt("S1",0); //Here the varialbe"S1","S2","S3" and "S4" needs to be the one which is used in our Firebase and MIT App Inventor Firebase.setInt("S2",0); Firebase.setInt("S3",0); Firebase.setInt("S4",0);

} void firebasereconnect() { Serial.println("Trying to reconnect"); //delay(500); //ESP.wdtFeed(); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); delay(5); ESP.wdtDisable(); }

void loop() { if (Firebase.failed()) { Serial.print("setting / number failed:"); Serial.println(Firebase.error()); firebasereconnect(); delay(5); return; } Serial.println("I am at relay 1");
val1=Firebase.getString("S1").toInt();
`

stackblogger commented 5 years ago

Its fixed!!!

go to C:/Users/{username}/My Documents/Arduino/libraries/firebase-arduino-master/src

open FirebaseHttpClient.h file, and paste following fingerprint =>

6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26

Now build and upload the sketch to NodeMCU using Arduino IDE

maxxWareZ commented 5 years ago

Its fixed!!!

go to C:/Users/{username}/My Documents/Arduino/libraries/firebase-arduino-master/src

open FirebaseHttpClient.h file, and paste following fingerprint =>

6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26

Now build and upload the sketch to NodeMCU using Arduino IDE

It will be great if you can help identify the cause. May be at some later time we might get into this again. So that this fingerprint is? What does it verifies?

msalik42 commented 5 years ago

Fixed!! In Arduino got to (Tools->Debug Leve->) and select (SSL+HTTP_CLIENT) and then upload your code to the NODEMCU(ESP8266) it works for me.

screenshot 121

Code:

include

include

define FIREBASE_HOST "nodemcu111.firebaseio.com"

define FIREBASE_AUTH "googleauthenticationcode"

define WIFI_SSID "CSJM"

define WIFI_PASSWORD "salik123ai145"

int hora = 0; float horas = 0;

void setup() { Serial.begin(115200);

// connect to wifi. WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("connecting"); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } delay(1000); Serial.println(); Serial.print("connected: "); Serial.println(WiFi.localIP()); pinMode(D1, OUTPUT); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); Firebase.setBool("lamp", false); }

void loop() { Serial.println("Enviando dados...."); //Firebase.setBool("lamp", true); Serial.println(Firebase.getBool("lamp")); delay (1000); if(Firebase.getBool("lamp")){ digitalWrite(D1,HIGH); }else{ digitalWrite(D1,LOW); } if (Firebase.failed()) { Serial.print("setting /message failed:"); Serial.println(Firebase.error()); return; } delay(5000); }

felossimon commented 5 years ago

for some reason old Firebase fingerprint doesn´t work for me, I change Firebase fingerprint for this E2:34:53:7A:1E:D9:7D:B8:C5:02:36:0D:B2:77:9E:5E:0F:32:71:17, and it fixed.

To find and change the current fingerprint:

Go to https://www.grc.com/fingerprints.htm Enter "test.firebaseio.com" Record the fingerprint (e.g. it is old one 6F:D0:9A:52:C0:E9:E4:CD:A0:D3:02:A4:B7:A1:92:38:2D:CA:2F:26) OpenC:\Users\\Documents\Arduino\libraries\firebase-arduino-\src\FirebaseHttpClient.h Replace value of kFirebaseFingerprint with the fingerprint (without colons) Recompile

Pekorishia commented 5 years ago

My code suddenly decided not to work and changing the fingerprint really did fix it.

Thank you guys.

O1iverS commented 5 years ago

I got the same problem and solved it by updating the fingerprint.

Thanks a lot!

Is there any way to let the Arduino update the fingerprint ?

praveenydv commented 5 years ago

Thanks a lot @felossimon. This worked for me...

dev-seunghyun commented 5 years ago

oh my god, holy shiTTTTTTTTTTTTTTTTT!!!!!!!!!! i love you so much guys!!!!!!!!!!!! Program worked for me !!!!!!! im so happy ~~~~

mostafaHammad commented 5 years ago

Oh .. still problem! !!!

dv00000 commented 5 years ago

Thank you a lot. My system is working!

mikelseha commented 5 years ago

Hi guys I have a question How Can i make solve this problem forever as I will make a product based on connection between firebase and NODEMCU ESP8266?

O1iverS commented 5 years ago

Here’s a working solution to get rid of this fingerprint relict: https://github.com/FirebaseExtended/firebase-arduino/issues/369#issuecomment-414152018

Alpha-1729 commented 5 years ago

https://www.hackanons.com/2018/02/iot-with-firebase-connecting-arduino.html

use the lower version of the arduino ide described in the link ....and use Arduinojson ver 5.13.5 all erros will be solved...

use wise uninstaller for removing all files of the latest version of the arduino............click on force uninstall

then restart the system....

install arduino ver 1.6.9

install 2.4.0 esp8266 board manager install 5.13.5 Arduinojson install firebase arduino described in the link...

change firebase url,key,ssid,password in the sample code in the link

upload the script all will be fine

heriveltogabriel commented 5 years ago

fingerprint change again?? My's devices don't work.

Em sex, 10 de mai de 2019 às 07:12, anil-aks notifications@github.com escreveu:

https://www.hackanons.com/2018/02/iot-with-firebase-connecting-arduino.html

use the lower version of the arduino ide described in the link ....and use Arduinojson ver 5.13.5 all erros will be solved...

use wise uninstaller for removing all files of the latest version of the arduino............click on force uninstall

then restart the system....

install arduino ver 1.6.9

install 2.4.0 esp8266 board manager install 5.13.5 Arduinojson install firebase arduino described in the link...

change firebase url,key,ssid,password in the sample code in the link

upload the script all will be fine

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/firebase-arduino/issues/285#issuecomment-491237394, or mute the thread https://github.com/notifications/unsubscribe-auth/ACAAJIJUIWOZZN3FK7VSZ2DPUVDBTANCNFSM4D42XTTQ .

--

AhmedAlhallag commented 3 years ago

for some reason old Firebase fingerprint doesn´t work for me, I change Firebase fingerprint for this E2:34:53:7A:1E:D9:7D:B8:C5:02:36:0D:B2:77:9E:5E:0F:32:71:17, and it fixed.

To find and change the current fingerprint:

Go to https://www.grc.com/fingerprints.htm Enter "test.firebaseio.com" Record the fingerprint (e.g. it is old one 6F:D0:9A:52:C0:E9:E4:CD:A0:D3:02:A4:B7:A1:92:38:2D:CA:2F:26) OpenC:\Users\Documents\Arduino\libraries\firebase-arduino-\src\FirebaseHttpClient.h Replace value of kFirebaseFingerprint with the fingerprint (without colons) Recompile

The only real solution out there!

Udakara commented 3 years ago

I got the same issue. what I did was, I uninstalled the firebase-arduino library and downloaded the latest version, and edited the fingerprint according to this. and it worked.

aayushali commented 3 years ago

for some reason old Firebase fingerprint doesn´t work for me, I change Firebase fingerprint for this E2:34:53:7A:1E:D9:7D:B8:C5:02:36:0D:B2:77:9E:5E:0F:32:71:17, and it fixed.

To find and change the current fingerprint:

Go to https://www.grc.com/fingerprints.htm Enter "test.firebaseio.com" Record the fingerprint (e.g. it is old one 6F:D0:9A:52:C0:E9:E4:CD:A0:D3:02:A4:B7:A1:92:38:2D:CA:2F:26) OpenC:\Users\Documents\Arduino\libraries\firebase-arduino-\src\FirebaseHttpClient.h Replace value of kFirebaseFingerprint with the fingerprint (without colons) Recompile

This solved my problem.. <3 Thank you very much..

smdthiranjaya commented 3 months ago

for some reason old Firebase fingerprint doesn´t work for me, I change Firebase fingerprint for this E2:34:53:7A:1E:D9:7D:B8:C5:02:36:0D:B2:77:9E:5E:0F:32:71:17, and it fixed.

To find and change the current fingerprint:

Go to https://www.grc.com/fingerprints.htm Enter "test.firebaseio.com" Record the fingerprint (e.g. it is old one 6F:D0:9A:52:C0:E9:E4:CD:A0:D3:02:A4:B7:A1:92:38:2D:CA:2F:26) OpenC:\Users\Documents\Arduino\libraries\firebase-arduino-\src\FirebaseHttpClient.h Replace value of kFirebaseFingerprint with the fingerprint (without colons) Recompile

Thanks a lot it works for me. ✨