Code Monkey home page Code Monkey logo

Comments (14)

mobizt avatar mobizt commented on July 3, 2024

From this

#define relayswitch 7

You can't use GPIO7 because it uses as MISO of SPI bus that connect with Flash memory. Your device can't run and program because no data to/from flash memory.

For query, you must and always assign orderBy as states in Firebase document, like this.

QueryFilter query;
 query.orderBy("id");
 query.equalTo("esp.2615");
 query.limitToLast(1);

You may get error like this return from server.
connection refused, Index not defined, add ".indexOn": "id", for path "/arushpass/cool/chill", to the rules

You also set the database rules like this by use wild card $ to any dynamic child keys of user_key which can be room1, room2,... and their child key $device. The name that use with $ can by any what you want.

 "rules": {
    ...
    ...
    ,
    "user_key":{
      "$room":{
           "$device":{
                ".indexOn":"id"
           } 
       }
    }
  }

or use only one wild card $ to refer to any child keys under user_key included room1, room2, device_name and so on.

 "rules": {
    ...
    ...
    ,
    "user_key":{
        "$device":{
             ".indexOn":"id"
       }
    }
  }

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Thanks for the quick reply

You also set the database rules like this by use wild card $ to any dynamic child keys of user_key which can be room1, room2,... and their child key $device. The name that use with $ can by any what you want.

 "rules": {
    ...
    ...
    ,
    "user_key":{
      "$room":{
           "$device":{
                ".indexOn":"id"
           } 
       }
    }
  }

or use only one wild card $ to refer to any child keys under user_key included room1, room2, device_name and so on.

 "rules": {
    ...
    ...
    ,
    "user_key":{
        "$device":{
             ".indexOn":"id"
       }
    }
  }

My user_key, device, room can be changed or deleted so do I have to edit the rules every time it is deleted or updated ?

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

Yes but it better to have permanent parent key.

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Oh

So can I set my rules like this:

"rules" : { .... .... .... , ".indexOn": "id" }

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

This means id is the parent key at the root of database and sort or select is no effect, indexOn should set to childs.

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Thanks

One more question:

Is it normal that when I am streaming I cannot execute Serial.println()

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

Don't understand. But don't serial print continuously like that, mcu needs idle time to feed the watchdog timer or handle WiFi task too, if you do that wdt reset may occur (only when connected to PC).

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Oh thanks

BTW can I use GPIO4. In the pinout it tells GPIO4 is not used

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

Yes, you can see any esp8266 dev board like this what the pin you can use
https://wiki.wemos.cc/products:d1:d1_mini
Some can be multifunction as basic GPIO and communication port as SPI or I2C.

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Thanks man
I'll try it now and tell you

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

I am getting:

not connected
Stream timeout, resume streaming...

and after I edit my id the relay does not change it's state

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

Your internet problem or something. Begin stream may fail in setup. What's about code in loop?

from firebase-esp8266.

arushgupta2007 avatar arushgupta2007 commented on July 3, 2024

Did not understand, did you ask code in loop?
I have not changed it a bit

from firebase-esp8266.

mobizt avatar mobizt commented on July 3, 2024

Try the examples
https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/Stream/Stream.ino
https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/Different_objects_stream/Different_objects_stream.ino
It should work, if any failed, it's your internet or AP problem.

from firebase-esp8266.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.