问题
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:
- Go to https://www.grc.com/fingerprints.htm
- Enter "test.firebaseio.com"
- 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
- Open
C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h
- Replace value of
kFirebaseFingerprint
with the fingerprint (without colons) - 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