Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Stream error and random data after 10 minutes #366

Open
@Lawris

Description

@Lawris

I have a NodeMCU project where something is triggered (switching my TV ON/OFF) when some data is updated in my Firebase.

Here is the main loop:

void loop() {

    if (Firebase.failed()) {
    Serial.println("streaming error");
    Serial.println(Firebase.error());
  }
  
   if (Firebase.available()) {
      Serial.println("value changed:");
      bool newphilipsOn = Firebase.getBool("room/PhilipsTV/on");
      bool newsamsungOn = Firebase.getBool("room/SamsungTV/on");

      if (newphilipsOn != philipsOn) {
        Serial.print("Philips TV state changed to ");
        Serial.println(newphilipsOn);
        philipsOn = newphilipsOn;
        irsend.sendRC6(0x1000C, 20);
        irsend.sendRC6(0xC, 20);
        irsend.sendRC6(0xC, 20);
        irsend.sendRC6(0xC, 20);
      }
    
      if (newsamsungOn != samsungOn) {
        Serial.print("Samsung TV state changed to ");
        Serial.println(newsamsungOn);
        samsungOn = newsamsungOn;
        irsend.sendSAMSUNG(0xE0E040BF, 32);
        irsend.sendSAMSUNG(0xE0E040BF, 32);
      }
      ...
      ...
   }
}

This code works pretty well for 10/15 minutes then it gets crazy, my TV starts to turn on and off.
To see what happened I checked the serial monitor and after 10/15 minutes I saw that Firebase.failed() was triggered multiple times. Right after that, Firebase.available() too and my variables newPhilipsOn and newSamsungOn was filled with wrong values, resulting in non-desirable actions.

This "crash" always occur after 10/15 minutes following the same pattern: getting several Firebase.failed() triggered, then, Firebase.available() is triggered with wrong values.

Since Firebase.error() isn't explicit I can't figure out what's wrong with my code.

What can I do ?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions