Serial Gateway Code to Query Node's Payload?



  • Greetings All,

    Would someone please give me an example of a line of serial gateway code that would query node x for its payload data? I have around 100 nodes so I do not want them randomly broadcasting data . . . that would lead to much cross-talk and lost data. Rather, I would like my serial gateway to ask, for example, "node 1, give me your data" and node 1 will present its sensor data. I tried to search the database but I could not filter properly to find an example. I feel stupid and lost and a little help here would really lift my spirits and get me moving on this. With great appreciation to all who respond - Baran


  • Admin

    You can send just send a value (SET) or use use the special request command (REQ) from your controller.
    Keep nodes awake and let them process incoming messages. When you receive the req-command just send a reply back to controller.

    You can look any of the example which processes incoming messages.



  • Do we have any "Wake on LAN/WiFi" kind of facility in MySensors to save energy in this kind of scenario? I believe i have read that this kind of functionality is available in nRF24L01...


  • Admin

    The radio consumes about 13.5mA in RX mode according to datasheet. Not sure about the clones we all use here, probably higher.

    13mA is still a little too much when running node on batteries. Will drain fast. So the question is the usecase for fiddling with interrupts other than speeding up the data transmission (pulling stuff out of the radios FIFO buffers so they don't fill up).



  • @hek said:

    The radio consumes about 13.5mA in RX mode according to datasheet. Not sure about the clones we all use here, probably higher.

    13mA is still a little too much when running node on batteries. Will drain fast. So the question is the usecase for fiddling with interrupts other than speeding up the data transmission (pulling stuff out of the radios FIFO buffers so they don't fill up).

    Tx consumption (though it can be put to sleep) will definitely be higher than Rx consumption, but the question is more about Push vs Pull. So, my question is more towards waking up a loooong sleeping (an hour or more sleep - Ex. a humidity sensor in a bathroom) node say only in Emergency conditions (in the example here, just to check if the bathroom floor of an elderly is dry or not before (s)he uses the bathroom ...)



  • Hek said "You can send just send a value (SET) or use use the special request command (REQ) from your controller."

    Sounds good, but my ignorance is deeper than you imagined. I do not have a controller, as I wish to send a suitable "request node data" through my serial gateway. Would someone please show me an example of serial code that would make such a request?

    Respectfully - Baran


  • Admin

    http://www.mysensors.org/download/serial_api_14

    To do a REQ(uest) set message-type to 2. For example:

    12;1;2;0;0;\n

    This requests a DOOR (0) -variable from sensor 1. Remember you must pick up this request in the callback of your sensors sketch.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.