Push data to cloud table

Home Forums NodeLua firmware Web IDE discussions Push data to cloud table

This topic contains 1 reply, has 2 voices, and was last updated by  Harold L. 3 years, 12 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #447

    jjg
    Participant

    I think I figured out how to go about fetching cloud data from the node, but what’s unclear is how I put data there in the first place.

    Is it possible to “set” cloud data from anything other than the node itself? For example, is there a curl command I can run on a Linux box to set a value that will be read by the node?

    Thanks!

    – Jason

    #453

    Harold L.
    Keymaster

    The short answer is YES.

    The Cloud data pipe is bidirectional by design, but I’m still working on the http APIs to put values/commands to Node.

    If you like, I’d like to give you a temporarily API for testing, but since it’s under heavy development, APIs may be changed in the future.

    Here is the http API:
    http://api.nodelua.org/api/device/rpc?action=&node_id=&cloud_id=&v0=&auth_opt=

    action:
    get: fetch value from Node
    set: set value to Node

    node_id: your Node ID

    cloud_id: create from the side panel of the WebIDE

    v0: the value to set to the Node

    auth_opt: this is the temporarily auth method, you can get it this way: open the source of the WebIDE in your browser, search for window.auth_for_nodeapi

    ====================

    On the Node side, you should register a callback function to run when receiving your value:
    cloud=Cloud:new(“xxx”)
    cloud:onrpc(function(action, v0)
    print(“rpc:”..action..”,”..v0)
    return 1
    end)

    If you met any problem with this API, I’ll answer ASAP, good luck!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.