Firebase-ESP8266: firebaseData.errorReason() returns "Connection refused"

I have a problem. When i try to read from the firebase realtime database, all it returnes is connection refused.

`

//----------------------------- //Wifi Manager #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library (you most likely already have this in your sketch) #include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal #include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal #include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic //----------------------------- //Firebase #include <FirebaseESP8266.h> #include <FirebaseESP8266HTTPClient.h> //-----------------------------

#define relayPin 5 #define statusLED 15 #define FIREBASE_HOST “This is the right one” #define FIREBASE_AUTH “This is the right one”

FirebaseData firebaseData;

int SMID = 123;

void setup() {

//digitalWrite(WifiLED, HIGH); pinMode(relayPin, OUTPUT); pinMode(statusLED, OUTPUT); Serial.begin(115200);

WiFiManager wifiManager; wifiManager.autoConnect(“SmartHomie”);

digitalWrite(statusLED, HIGH); Serial.println(“Det virker”); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); //wifiManager.autoConnect(“SmartHomie”); } void loop() {

// Check her på MCU’ens respektive path til databasen

digitalWrite(relayPin, HIGH); delay(3000); digitalWrite(relayPin, LOW); delay(3000);

int val = 0; Serial.println(Firebase.getInt(firebaseData, “number”)); if (Firebase.getInt(firebaseData, “number”)) {

//Success, then read the payload value

Serial.println(“DET FUCKINGER VIRKER!!”);

}else { //Failed, then print out the error detail Serial.println("Error: "+firebaseData.errorReason()); } }` Udklip

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 73 (28 by maintainers)

Most upvoted comments

OMG thank you so much mechasif, it worked for this case, I followed your suggestion to remove “https://” and “/” and in the starting path I added “/” like this “/machine/1AA/number”

OK it works. I think I found the error in your FIREBASE_HOST you wrote “…firebaseio.com/”. Slash behind .com is not valid, it should be “???.firebaseio.com”

Library does not touch the network stacks, it plays with requests and responses.

It’s not the library issue. It’s your router and network configuration issue.

This is not the Q&A forum which no one care about your questions and problems.

This is the place where I take my time to support you.