Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time

偶尔善良 提交于 2019-12-01 11:18:34

问题


Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time No updation on firebase as well.

or should I change the cloud server?

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

    // Set these to run example.
    #define FIREBASE_HOST "example.firebaseio.com"
    #define FIREBASE_AUTH "token_or_secret"
    #define WIFI_SSID "SSID"
    #define WIFI_PASSWORD "PASSWORD"

    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());

      Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
    }

    int n = 0;

    void loop() {
      // set value
      Firebase.setFloat("number", 42.0);
      // handle error
      if (Firebase.failed()) {
          Serial.print("setting /number failed:");
          Serial.println(Firebase.error());  
          return;
     }
      delay(1000);
    }

回答1:


The Firebase Arduino library has a reference to a fingerprint of the Firebase SSL certificate. This fingerprint may not match the current fingerprint.

This fingerprint is in FirebaseHttpClient.h (typically in C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h).

To find and change the current fingerprint:

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

e.g. the following fingerprint works at this point of time:

static const char kFirebaseFingerprint[] =
  "6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26";

See https://github.com/FirebaseExtended/firebase-arduino/issues/328



来源:https://stackoverflow.com/questions/53068413/unable-to-connect-nodemcu-with-firebase-as-console-shows-setting-number-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!