FirebaseExtended/firebase-arduino

ESP8266 not connecting to firebase!

JaysArtworks opened this issue · 78 comments

I've a problem connecting the ESP8266 board to Firebase (sketch is correct), but the board connects to the wi-fi, I've already updated the Arduino Json Library and i reinstalled the Firebase library, but nothing (2 months ago I had no problems with the connection).

Same for me, it fails to read and write. Although Firebase.begin gives success. I am using DB Secret.

try this : #369

I'll try this solution later.

@prj-x I've I tried to change the Firebase fingerprint, but nothing...it is working for you?
I'm a bit worried, beacuse i have to finish a project for school...

I have tried changing the Firebase fingerprint as well as updating the library itself but no use ?
Firebase begins connection without any error but
Unable to read data from firebase and streaming also fails,
Does Anyone know the solution ?

@prj-x
@JaysArtworks
@adamrabbani

I Changing the firebase fingerprint, nothing. I'm try get new firebase library complete, but don't work.
Help-us!!

@prj-x
@JaysArtworks
@adamrabbani

@heriveltogabriel @santoshn547 @JaysArtworks

try use old libary for a while..
This link --> https://github.com/RaemondBW/firebase-arduino

but this library doesn't work for stream function
just simple function like "get" and "set" is work.

download and edit to newest fingerprint.. (FirebaseHttpClient.h)
6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26

@adamrabbani

Using the old library in esp8266 it is reseting.

it shows the following exception :
Exception (28):
epc1=0x4020e636 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

and it continuously resets .
I can say that my sketch is error free, Its because of using old library .
Does anyone know the solution ?
Stuck in a project thats in due.

@santoshn547 can i see the code ?

@adamrabbani
`#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseObject.h>
#include <ESP8266Ping.h>
#include <ESP8266WiFi.h>//https://github.com/esp8266/Arduino
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager

#define firebaseURl "****"
#define authCode "*****"

FirebaseArduino FirebaseStream;
FirebaseArduino MyFirebase;
String chipId = "123";
WiFiManager wifiManager;

int leds[4] = {D1, D2, D3, D4};
volatile int states[4] = {LOW, LOW, LOW, LOW};

#define BOUNCE_DURATION 20 // define an appropriate bounce time in ms for your switches
volatile unsigned long bounceTime=0; // variable to hold ms count to debounce a pressed switch
String path = chipId + "/status";
String devicePath ;

#define DEBOUNCE 20
byte buttons[] = {D5, D6, D7, D8};
#define NUMBUTTONS sizeof(buttons)

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

setupLeds();
setupButtons();
attachInterrupt(digitalPinToInterrupt(D5),hello,CHANGE);
attachInterrupt(digitalPinToInterrupt(D6),changeState,CHANGE);

setupLeds();
setupButtons();    
wifiManager.autoConnect("AutoConnectAP");
Serial.println("connected...yeey :)");

bool ret = Ping.ping("www.google.com");
if (ret == true){
MyFirebase.begin(firebaseURl,authCode);
FirebaseStream.begin(firebaseURl,authCode);
FirebaseStream.stream(chipId + "/status"); 
};  

}

void loop() {

detachInterrupt(D5);
detachInterrupt(D6);

if (FirebaseStream.failed()) {
FirebaseStream.stream(chipId + "/status");
Serial.println("streaming error");
Serial.println(Firebase.error());
}

if (FirebaseStream.available()) {
FirebaseObject event = FirebaseStream.readEvent();
String eventType = event.getString("type");
Serial.print("event: ");
getData();
Serial.println(eventType);
if (eventType == "put") {
Serial.print("data: ");
getData();
}
}

  byte btn = pressed();
  String devicePath;

switch (btn)
{
case 0:
Serial.println("button one pressed");
devicePath = chipId + "/status/001";
doOnOffLed(btn, devicePath);
break;
case 1:
Serial.println("button two pressed");
devicePath = chipId + "/status/002";
doOnOffLed(btn, devicePath);
break;
case 2:
Serial.println("button three pressed");
// devicePath = chipId + "/status/003";
// doOnOffLed(btn, devicePath);
break;
}

}

void getData() {

FirebaseObject object = MyFirebase.get(path);
bool led1 = object.getBool("001");
bool led2 = object.getBool("002");

digitalWrite(leds[0], led1);
digitalWrite(leds[1], led2);

Serial.println(led1);
Serial.println(led2);

int D1state = led1;
states[leds[0]] = D1state;

int D2state = led2;
states[leds[1]] = D2state;
}

void hello(){
if(millis() > bounceTime)
{
btn1Changed = true;
int state = !states[0];
states[0] = state;
Serial.println(state);
digitalWrite(D1, state);
bounceTime = millis() + BOUNCE_DURATION; // set whatever bounce time in ms is appropriate
}

}

void changeState(){
if(millis() > bounceTime)
{
btn2Changed = true;
int state = !states[0];
states[0] = state;
Serial.println(state);
digitalWrite(D2, state);
bounceTime = millis() + BOUNCE_DURATION; // set whatever bounce time in ms is appropriate
}
}`
The above Sketch was working fine before 5 days.

Hi everyone
here is the solution that is working for me.

  1. download the file from the link : https://github.com/firebase/firebase-arduino/files/2268787/firebase-arduino-master.zip
  2. extract the zip file.
  3. copy everything from the file and paste and replace into the location C:\Users\hossa\Documents\Arduino\libraries\firebase-arduino-master
  4. now download this file from the link https://github.com/firebase/firebase-arduino/files/2268800/FirebaseHttpClient.zip
  5. extract it and paste and replace the file into C:\Users\hossa\Documents\Arduino\libraries\firebase-arduino-master\src

image
image

@santoshn547
sorry the old library doesn't work for stream function
but basic function like "get" and "set" is work.

@adamrabbani
Using the below code only returns 0 while the data in firebase is 1.
I am not getting data from firebase it is blank when converted to String.
My Url and Authcode is right.
MyFirebase.begin(firebaseURl,authCode);

FirebaseObject object = MyFirebase.get(path);
bool led1 = object.getBool("001");
bool led2 = object.getBool("002");

Is my code right for the old library ?

@kabir1995 What code are you using to begin connection as well as to get bool from firebase ?

@kabir1995 Thank you very much man! Now the code is working, I did all the steps which you said above, and i deleted the #include <ArduinoJson.h> from the code, because when i upload the code with the Json Library included, it gives me errors, anyway all is working, so thank you again!

@JaysArtworks
What code are you using for reading data from firebase ?

 n=Firebase.getString("FAN_STATUS").toInt();
 Serial.println(n);
  // handle error
  if (n==1) {
      Serial.println("Fan ON");
      digitalWrite(Fan,HIGH);
      return;
      delay(100);
  }
 else{
  Serial.println("Fan OFF");
  digitalWrite(Fan,LOW);
 }

@santoshn547 These are the lines of code which i'm using to get the value from Firebase, when the value is 1 the fan turns on and when is 0 it turns off.

@JaysArtworks
How do you begin connection to firebase ?
How do you give path of where your string is located in firebase ?

@kabir1995 Thank you so much friend. Your solution worked and saved my project.

HELLO PERSONAL I HAD A PROJECT WITH ESP8266, WHERE IT WORK PERFECTLY, BUT AFTER THAT CHANGE EVERYTHING WAS ONLY, I COULD CONNECT THE INVENTOR APP WITH THE DATABASE, BUT THE ESP8266 HE SHOWS CONNECTED THE WAFI, BUT IT DOES NOT CONNECT TO THE DATA BANK FROM FIREBASE

@adamrabbani I do not understand why my copila is not what is being the mistake?
here in mine
of the board error

@Wagnerviana apply @kabir1995 solution written above. I am also facing similar problem and finally kar it's solution work.

Can you confirm that was fixed with #368 ?

@karan13421
let me ask you ?
Are you using ESP 8266?
THE ARDUINO

@karan13421
THEN KNOW, THAT MY PROJECT, I HAD ALREADY HAD IT UP TO THIS FIREBASE CHANGE, BUT AGR PR APPLY, IN MY RESIDENTIAL AUTOMATION, WHERE I OPEN MY GATE WINDOW, AIR DEFINITIONED TELEVISION, I AM NOT GONNA APPLY.
TRY IT TO A HERE CODE OF @adamrabbani BUT TA DAMAGE PLATE ERROR, MY ANCIENT CODE WILL CONNECT TO THE WIFI BUT DOES NOT SEND AND NOR RECEIVE THE FIREBASE INTENDI.
SOMEONE WHO CAN HELP ME?

BOMM I CAN CONTAIN EVERYTHING OK,

NO DATA BANK MAKES READINGS
BUT I NEED TO TRANSPORT MY DESIGN OF IOT AND AUTOMATION RESINDENTIAL, THAT WAS FUNCTIONING, FOR THAT NEW DEMANDS THAT CREATED, In order for this to work my code within this new version

@Wagnerviana CAN YOU SHARE THE CODE ?

@kabir1995
MUITO OBRIGADO
MUITO OBRIGADO MESMO
SALVOU MEU TRABALHO DE CONCLUSÃO DE CURSO
MUITO OBRIGADO
FUNCIONOU SUA DICA

@prj-x
@JaysArtworks
@adamrabbani
@kabir1995

I have a problem with nodemcu and firebase ......when nodemcu start working it connects to wifi then connects to the firebase then i send int and every thing is working fine ......
but if nodemcu lost it connection to wifi and then reconnect again successfully then it can't connect to firebase again untill i use ESP.restart();

Thanks @kabir1995 . In my case it worked.

@kabir1995 Works like a charm. Thank you.

@AbdelrahmanElazhary
im having the same issue, were you able to solve it?

I tried the old library but with the new fingerprint, but still no use... I am going crazy now, what's wrong with my setting???

In my case, when i turn on the ESP8266 everything works fine for a while, until the connection with firebase for some reason stops, and im having problems reconnecting to firebase again. Can somebody give me an idea to solve this? without manually reseting the ESP8266 (witch kills the purpose of the ESP8266)

same problem when i read data this works fine but then stops connections with firebas, someone can help us? please.

      same problem when i read data this works fine but then stops connections with firebas, someone can help us? please.

Did you find the problem?

Tôi củng thế. Bị dừng stream khi hoạt động được 2 giờ. Và không biết kết nối lại như thế nào

I've tryed many times, but only work when I changed on Arduino IDE > TOOLS > DEBUG LEVEL > SSL + HTTP_CLIENT

Firebase fingerprint change again
E2:34:53:7A:1E:D9:7D:B8:C5:02:36:0D:B2:77:9E:5E:0F:32:71:17

#373 (comment)
@felossimon
for me, new fingerprint is not working. but the previous fingerprint ("6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26") still working.
firebasehttpclient

@kabir1995, maybe it start to change by country, yesterday my 6 esp8266 fail to connect to firebase until I change for the new fingerprint. I live in Mexico.

@felossimon maybe. anyway thank you for your information. In the future, if we face problem we can use the new fingerprint.

i used new fingerprint but my nodemcu work for 30 minute, then it's not working, sorry for my bad English

Hello, I've fixed the problem permanently following Mr mikrodunya guide....great!!!!
In my case I dont care to skip fingerprint verification...so skipping this step in the WiFiClientSecureAxTLS.cpp everything starts working fine again...Nice because my distributed esp8266 HW won't be affected by firebase fingerprint changes. I've just include:

bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
{
return true; <---- include this line to skip verification

Again thaks to mikrodunya great job!!!
regards

@NguyenHuyHiep check this post: #388 (comment) thankyou so much, it's work for me !

@Nicybru i dont know where did you find his guide but here is the link
https://github.com/mikrodunya/Firebase-Arduino-Skip-fingerprint-Verification
@mikrodunya thank you.

Please can anyone add this "fingerprint" like a variable so we can define in setup?

  Firebase.beginer(FIREBASE_HOST, FIREBASE_AUTH, "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17");

help me, i can connect to firebase 2019

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino

static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino

static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

how do u know these changes?

blow line in file FirebaseHttpClient.h this file found inside you library of Arduino
static const char kFirebaseFingerprint[] = "E2 34 53 7A 1E D9 7D B8 C5 02 36 0D B2 77 9E 5E 0F 32 71 17";

how do u know these changes?

C:\Users\YOURPCNAME\Documents\Arduino\libraries\firebase-arduino-master\src ==> open file FirebaseHttpClient.h
image

thanks ALOT @kabir1995 THAT'S WORKS

again, firebase update 19/04/2019 can't connect to firebase again

19/04/2019 can not conenct Firebase data base ...

"B6 F5 80 C8 B1 DA 61 C1 07 9D 80 42 D8 A9 1F AF 9F C8 96 7D"; // 2019-04

Thanks, @MaiVanThanh197 Now it is working. From where did you find the new key.

@karan13421

Use this site and check for Test.firebaseio.com :-
https://www.grc.com/fingerprints.htm

sir can send me how to insert a data from nodemcu to firebase.

@raghavendralg, you can check out the examples that are given in ArduinoFirebase library in Arduino IDE

I am facing this problem from 2 weeks, Firebase is readable and writeable from my mobile app but from Node MCU it is not accessible. I did all possible work, upgraded library, applied the latest fingerprints, but nothing is working. In the demo program in examples, its showing setting number failed, Please help me as I have to submit this project.

"B6 F5 80 C8 B1 DA 61 C1 07 9D 80 42 D8 A9 1F AF 9F C8 96 7D"; // 2019-04

it is working for me , thanks man @MaiVanThanh197 you saved me.

hey, alternate to firebase data is https://github.com/mobizt/Firebase-ESP8266

BCSJH commented

I followed as you explained. But it doesn't get the Firebase value. Help me

#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"

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

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

// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {

delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));

delay(1000);

}

}
1
2

I followed as you explained. But it doesn't get the Firebase value. Help me

#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"

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

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

// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {

delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));

delay(1000);

}

}
1
2

Can you screenshoot your full json?, maybe you missing your parent path.

BCSJH commented

I followed as you explained. But it doesn't get the Firebase value. Help me
#include <FirebaseArduino.h>
#include <ESP8266WiFi.h>
#define FIREBASE_HOST "Host"
#define FIREBASE_AUTH "Auth"
#define WIFI_SSID "gg"
#define WIFI_PASSWORD "gg"
void setup() {
Serial.begin(9600);
// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// put your setup code here, to run once:
Firebase.begin (FIREBASE_HOST, FIREBASE_AUTH);
}
void loop() {
delay(1000);
// put your main code here, to run repeatedly:
if (Firebase.failed()){
Serial.print("Error");

delay(1000);

}
else{
Serial.print("Here");
Serial.println(Firebase.getString("Hello"));
delay(1000);
}
}
1
2

Can you screenshoot your full json?, maybe you missing your parent path.

Ah I found.
I don't know how to do it this way.
So I use
#include "FirebaseESP8266.h" //Firebase
#include <ESP8266WiFi.h> //WIFI
FirebaseData firebaseData;
FirebaseJson json;
void printResult(FirebaseData &data);

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

"but i'm unable to do it,". do it from where ? from web or android studio

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

bro can you please tell me your Arduino json library version, firebase-arduino library version?

hi, i'm trying to get and set values on the firebase using nodemcu esp8266 module, but i'm unable to do it, there's no error but firebase doesn't get updated!, ssid, password, firebasehost, database secret all are correct and when i try to upload same code on my friend's pc it starts working, please help me!

"but i'm unable to do it,". do it from where ? from web or android studio

i am uploading code through arduino ide, using nodemcu esp8266 module. for the reference i am following this method
https://www.instructables.com/id/Esp8266-Firebase-Connection/

I use this method and everything work good.
Screen Shot 2020-01-03 at 21 36 13

bro can you please tell me your Arduino json library version, firebase-arduino library version?

Hi @Saadi986

Use ArduinoJson5.x library :-

https://m.youtube.com/watch?v=6oWI_xhAtrY

https://github.com/bblanchon/ArduinoJson/tree/5.x

Checkout how to upload code to NodeMCU ESP8266 using Arduino IDE:-
https://m.youtube.com/watch?v=AaWbRhCl0XI

Thanks

Firebase issue on esp8266

  1. Visit this site

  2. https://www.grc.com/fingerprints.htm

  3. search your newest fingerprint by typing * test.firebaseio.com *

  4. take your fingerprint

  5. look for this library and replace it here your in :

"Arduino/libraries/firebase-arduino-master/src/FirebaseHttpClient.h"