Hey everyone,
So I just got a Node-RED server running locally on my Windows desktop. My goal is to get the data from the payload of all devices registered under my application, then send a POST to my Flask web-server at an endpoint which will store the data.
So to test this all out I’ve got a TTN Event node which outputs to debug. I’ve ensured everything is correct multiple times over, including the APP ID and Access key. I’m using the default discovery address (discovery.thethingsnetwork.org:1900) and everything else seems to be configured properly. Data also appears when received on The Things Network side for my application, but no data comes in on the Node-RED server and I haven’t been able to figure out why.
Where did you find you need to use that address? Have you checked the instructions? You should connect to port 1883 or (for SSL) 8883 on a system with a name like ‘eu.thethings.network’.
Also, I don’t see how one could even specify this, given the screenshots in the instructions @kersing linked to? However:
Very true when using a regular MQTT client in Node-RED (and, to be honest, that might actually be much easier to understand and use…)
But it seems the TTN library uses that discovery.thethingsnetwork.org:1900 to tell which MQTT server to use, given other parameters such as the application id and region:
That said, I don’t think one can change that discovery address?
According to the documentation in the quick start guide, it points out to either use your private installation address or the public discovery address. I don’t have any MQTT client installed locally so I just left it default since it’s pre-populated with the discovery.thethingsnetwork.org:1900 address.
This is what it shows for me.
I suppose I can just setup an MQTT client if that might be easier to get working. One things I can’t figure out is if there is even a topic I can use to pull the payload when received. With the Node-RED native tool there is the ttn event node, but with MQTT, I only see the topics found here. None of which give the payload when TTN receives it.
Okay so I guess I misinterpreted what I could use the Node-RED and MQTT extension for. I successfully receive a message upon updating information on a device registered to the application so it must be working.
Is there no way for me to send a payload that is sent from a device over LoRa registered to my application to my Node-RED? I’m just looking for a method to get the payloads that my application receives from my nodes and POST them to my webserver. I haven’t found anything in the API that allows me to do this…
Apparently the screenshots in the documentation on the website are outdated?
Every Node-RED installation I saw has a client in “Input”, just like it has HTTP and all. But of course, the TTN thing should work. Unfortunately, I have only used some old release a long time ago and stopped using that version did not allow for wildcards:
But it seems the library has evolved, like now using the discovery which I assume makes configuration easier, and maybe wildcards work now as well?
It does: see "payload_raw" and "payload_fields" in the section “Uplink Messages”.
Also, make sure you’ve got the last version installed:
Yeah I got the integration working now. Is there any way for me to send the data to localhost or 127.0.0.1? Or is that not going to be possible? This would help immensely in working on developing my project.
I can, of course, properly send data to requestbin or the like, but I have no way to send any data to a locally hosted server since it’s not exposed to the web yet.
Not knowing your project, my suggestion for getting data locally would be to run a mqtt client locally within your project if it is a standard server side web stack this should be no more complicated than setting up Node Red ;). I only say this because you mentioned forwarding data on to localhost.
If you just want to forward packets to you local web address you can save a bunch of time and use the HTTP integration in the web console and send POSTs to a tunneled endpoint using ngrok or similar.
Yeah the HTTP integration is much easier to do. I’ll check out ngrok.
I’ve got everything setup on ngrok and have it properly pointing to the Flask webserver I have setup. I’m trying to get data sent to a specific endpoint on my webserver so I’ve added the /api/get_stuff endpoint after the public ngrok server address in my http integrations. My issue is that when I send a POST using the payload test on the device page to that endpoint nothing is coming up at all.
EDIT: Okay it seems it works now! Thanks for the help everyone
Did anyone actually manage to solve this original problem (ttn event and uplink nodes not able to be set up to work in Node-Red)???
I have struggled to get this feature working within Node Red. I can see data on my TTN console. I can even send the data to Cayenne. But, I just can not get the data from TTN to Node Red.
I have been able to get my Node Red Flow to accept data from a Sigfox feed quite happily.
I have tried setting up a generic MQTT connection to Node Red also, but it just does not work.
Node Red indicates that my connection to TTN has been established but not data comes through.
I need some help to work out what is going on.
I really do not want to set up a HTTP connection as appears to have been successful in the case above.
After a little more experimenting, I have been able to get the standard mqtt nodes working for Node Red but I still can not get the ttn specific nodes working. I wondering whether the discovery feature is working correctly for these???
@Batigolle I am struggling to set up all the parameters correctly I suspect.
I believe I have entered all the correct details (the ttn uplink node shows connected) and yet I can not get any data through. I am not sure what to put in the field box. I left it blank hoping that it would pass all application data, but still nothing comes through.
In frustration I used the standard mqqt nodes and I have been able to get these to work.
I thought the idea of the ttn specific nodes was to make things easier. Not so! The documentation is also miles out of date which does not help.
Thanks @Batigolle looking at the details you have referenced, I believe that I have everything set correctly. I have left the field box empty, but I still get nothing coming through. I believe there could be an issue with TTN. One thought I had is that the discovery process is not working correctly. i am using the service through the meshed routers in Australia but have the application being supported through eu.thethings.network. could this have something to do with my issue. As I mentioned previously, I can get it all to work by using the standard mqtt nodes for Node Red.
It looks like a bug to me!!!
TTN event node is working for me (nodered v0.18.7; TTN nodes v2.04)
But I’m missing something: the MQTT topic is not given as msg.topic like it is in the plain MQTT node. This makes it sort of useless to me (as I want to grab all events and then deal with them according to device and topic…) => feature requests go where?
no update on this topic?
I have node red working fine and today stopped and ttn uplink do not show connection, but on the log there are no errors on ttn connection, so I dont know how to find the solution.
Please any help is welcome.