How to have multiple dynamic paths with FirebaseESP8266?

Viewed 27

I would like to retrieve several paths in my Firebase database, but I have the error "send request failed" in this part of the code:

Serial.printf("get text challenge ... %s\n",
Firebase.getString(fbdoChallenge, getPathChallenge) ?
fbdoChallenge.to<const char *>() :
fbdoChallenge.errorReason().c_str());

I would like to know how to retrieve several paths dynamically using the "FirebaseESP8266" library.

Here is an example of my code that I was able to perform:

void loop() {
  // recovery path BDD
  String getPathIsAppear = String("/sensors/ID_0000/is_appear");
  String getPathCategories = String("/sensors/ID_0000/categories");
  String getPathChallenge = String("/dataIHM/") + fbdoCategorie.to<const char *>() + String("/") + numberRandom + String("/") + String("challenge");
  if (Firebase.ready() && (millis() - sendDataPrevMillis > 15000 || sendDataPrevMillis == 0)) {
    sendDataPrevMillis = millis();
    Serial.printf("Sensor is appear... %s\n", Firebase.getBool(fbdo, getPathIsAppear, &link) ? link ? "" : "" : fbdo.errorReason().c_str());
    Serial.printf("get text categorie... %s\n", Firebase.getString(fbdoCategorie, getPathCategories) ? fbdoCategorie.to<const char *>() : fbdoCategorie.errorReason().c_str());
    Serial.printf("get text challenge ... %s\n", Firebase.getString(fbdoChallenge, getPathChallenge) ? fbdoChallenge.to<const char *>() : fbdoChallenge.errorReason().c_str());
    if (link == 0) {
      Serial.println(screenIsAppear());
    } else {
      Serial.println(screenHomePage());
    }
  }
  delay(2000);
}
0 Answers
Related