GTWay identity , get it in node red ?
- This topic has 5 replies, 4 voices, and was last updated 8 years, 7 months ago by
Véranith LY.
-
AuthorPosts
-
October 17, 2016 at 11:38 am #15056
magouero
ParticipantHello,
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
October 17, 2016 at 12:47 pm #15059Jeff Hatch
KeymasterMagouero,
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
October 24, 2016 at 12:56 pm #15118magouero
ParticipantOK.
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-sentBut 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.
JSONThe 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 ?
ThanksOctober 24, 2016 at 2:18 pm #15121Bryan Tran
ModeratorHi magouero,
Try it with: http://127.0.0.1/api/system/deviceId instead with the ipaddress: 192.168.2.3
Thanks,
BT
October 24, 2016 at 2:35 pm #15122magouero
Participantah 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 idThank you Bryan and Jeff
Now i have to use it to configure a mqtt broker having this serial number in its client id. Possible ?
March 27, 2017 at 4:27 am #18010Véranith LY
ParticipantHello
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
-
AuthorPosts
- You must be logged in to reply to this topic.