由于控制台显示设置/number失败,因此无法将NodeMCU与Firebase连接:每次 [英] Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time
问题描述
由于控制台显示设置/number失败,因此无法将NodeMCU与Firebase连接:每次 在Firebase上也没有更新.
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);
}
推荐答案
Firebase Arduino库具有对Firebase SSL证书指纹的引用.该指纹可能与当前指纹不匹配.
The Firebase Arduino library has a reference to a fingerprint of the Firebase SSL certificate. This fingerprint may not match the current fingerprint.
此指纹在FirebaseHttpClient.h
中(通常在C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h
中).
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:
- 转到 https://www.grc.com/fingerprints.htm
- 输入"test.firebaseio.com"
- 记录指纹(例如,当前为
03:D6:42:23:03:D1:0C:06:73:F7:E2:BD:29:47:13:C3:22:71:37:1B
- 打开
C:\Users\<User>\Documents\Arduino\libraries\firebase-arduino-<version>\src\FirebaseHttpClient.h
- 用指纹替换
kFirebaseFingerprint
的值(不带冒号) - 重新编译
- Go to https://www.grc.com/fingerprints.htm
- Enter "test.firebaseio.com"
- Record the fingerprint (e.g. it is currently
03:D6:42:23:03:D1:0C:06:73:F7:E2:BD:29:47:13:C3:22:71:37:1B
- 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[] =
"03 D6 42 23 03 D1 0C 06 73 F7 E2 BD 29 47 13 C3 22 71 37 1B";
请参见 https://github.com/FirebaseExtended/firebase-arduino/issues/328
这篇关于由于控制台显示设置/number失败,因此无法将NodeMCU与Firebase连接:每次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!