GTWay identity , get it in node red ?

Home Forums General GTWay identity , get it in node red ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15056
    magouero
    Participant

    Hello,

    Is there a way to get the serial number or the UUID or any unique GTWay number in order to publish on a MQTT topic that includes this number in the path/topic name ?
    Using a exe node and using a linux command ?

    Thanks

    #15059
    Jeff Hatch
    Keymaster

    Magouero,

    You can get the device ID through an HTTP REST request to the API on the device:

    http://127.0.0.1/api/system/deviceId

    You will get a JSON collection back that looks like:

    {
    “code” : 200,
    “result” : “18587503”,
    “status” : “success”
    }

    The Multitech MTR product has an API that is very similar, and is documented at:

    http://www.multitech.net/developer/software/mtr-api-reference/

    Jeff

    #15118
    magouero
    Participant

    OK.
    Thanks but i need to do it FROM node-red in order to get that number and later on publish on a MQTT topic that uses the number in the topic
    e.g;: project/gatewayNumber/data-to-be-sent

    But using node-red i do not see how .

    Any idea ?

    EDIT:
    i tried using
    inject node — http request node –debug node
    with
    GET method
    https://192.168.2.3/api/system/deviceId
    and basic authentication with username and password.
    JSON

    The best answer i get is
    { “code”: 401, “error”: “not logged in”, “status”: “fail” }

    Same with http:// (not httpS).
    although usename and password are correct.

    EDIT2:
    using
    GET https://192.168.2.3/api/login?username=admin&password=admin
    i got success but still cannot get the id of the gateway. I think the token given in the result of last command is to be used somehow but dunno what to do with it.

    any other way or idea ?
    Thanks

    • This reply was modified 7 years, 6 months ago by magouero. Reason: add information after trial
    • This reply was modified 7 years, 6 months ago by magouero. Reason: add information after 2nd trial
    #15121
    Bryan Tran
    Moderator

    Hi magouero,

    Try it with: http://127.0.0.1/api/system/deviceId instead with the ipaddress: 192.168.2.3

    Thanks,

    BT

    #15122
    magouero
    Participant

    ah indeed its simpler than what i did:
    httpnode for login —>function node to make the request sentence with login and token —-> httpnode to get the id

    Thank you Bryan and Jeff

    Now i have to use it to configure a mqtt broker having this serial number in its client id. Possible ?

    #18010
    Véranith LY
    Participant

    Hello

    Thanks for the HTTP hint to retrieve the gateway’s ID (http://127.0.0.1/api/system/deviceId).

    In my case, I want to have several gateways setup as packet forwarders and only one hosting the lora network server with Node-RED (on an aep version).

    How, from the node-red instance, can I know where an actual LoRa packet comes from (from which gateway) ?

    Many thanks

    Veranith

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.