控制台显示设置/编号失败时,无法将NodeMCU与Firebase连接:每次

时间:2018-10-30 16:04:21

标签: firebase arduino esp8266 nodemcu

由于控制台显示设置/ number失败,因此无法将NodeMCU与Firebase连接:每次     在firebase上也没有更新。

还是应该更改云服务器?

    #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 个答案:

答案 0 :(得分:1)

Firebase Arduino库具有对Firebase SSL证书指纹的引用。该指纹可能与当前指纹不匹配。

此指纹在FirebaseHttpClient.h中(通常在C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h中)。

要查找和更改当前指纹:

  1. 转到https://www.grc.com/fingerprints.htm
  2. 输入“ test.firebaseio.com”
  3. 记录指纹(例如,当前为6F:D0:9A:52:C0:E9:E4:CD:A0:D3:02:A4:B7:A1:92:38:2D:CA:2F:26
  4. 打开C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h
  5. 用指纹替换kFirebaseFingerprint的值(不带冒号)
  6. 重新编译

例如以下指纹在该时间点有效:

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

请参见https://github.com/FirebaseExtended/firebase-arduino/issues/328