Chat freely about anything...

User avatar
By Seif_1999
#83393 I'am trying to build a simple smart lights system using esp8266-12E and some relays, where I created a firebase database so that lights can be controlled from internet.
My problem is when I tried using the function stream() from arduino firebase library and check firebase.available() to see if there is any change, it always return true even though nothing is changed in the database, here is the code
Code: Select all#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <Firebase.h>
#include <FirebaseArduino.h>



#define FIREBASE_HOST "xxxxxxxx"

#define FIREBASE_AUTH "xxxxxxxx"

#define WIFI_SSID "xxxxxx"

#define WIFI_PASSWORD "xxxxxx"

#define LED1 14

void setup() {

  pinMode(LED1, OUTPUT);
  digitalWrite(LED1, 0);


  Serial.begin(9600);

  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);
  Firebase.stream("LED1");



}

void loop() {

  if (Firebase.available()) {
   Serial.println("Action!");


  }


  if (Firebase.failed()) // Check for errors
  {

    Serial.print("setting /number failed:");

    Serial.println(Firebase.error());

    return;

  }

  delay(10);

}