How to set LoRa TTN node to trigger another node?

The LoRa node receives a payload and writes the measurement in a database, so far so good. But I also want the LoRa node to activate / trigger the HTTP Request when a payload comes in. Can someone tell me which node I need to use (near the arrow) and how to set it up?

I suppose, even if you did not explain it, that you want to assemble a url that is partly based on or depend on the msg.payload content? In such case I would use a change node and a javascript expression but there are also other methods possible. A quick and dirty for testing, use a function node and some code

1 Like

Let me explain, the URL does not depend on the LoRa payload. I only want to execute/trigger the HTTP Request when a LoRa payload comes in. Just like when I use an Inject node with a timestamp, this works and triggers the HTTP Request in this flow. But, as you will understand, I will let this happen automatically when the LoRa node receives a payload. Hope this makes things clear.

The flow you have should work just the same as using an inject node. When the LoRa node sends a message it will appear in the debug and will also trigger the http request node. Don't you need to set the request body for the request node though? In which case follow @krambriw's advice.

1 Like

Sorry to bother you with this. I already assumed it should work, but it didn't. Because you wrote that I had it all set up properly, I restarted my Raspberry with NodeRED and now it works :wink:

It has happened several times before that a flow only worked after a reboot of my Raspberry, mostly in combination with a TTN node. Is this a known problem?

Thanks anyway for your quick reply!

Not heard of that problem before... but will listen out for more. Thanks

When it wasn't working was the message appearing in the debug output from the LoRa node?

No, the debug output stayed empty but the database was written as expected.

That means it was a problem with the http request. Have you overridden the request timeout in that node?

Not that I know:

Can you show us the log you get when you restart node red please, you can get that using

node-red-stop
node-red-start

First I entered node-red-stop and after a node-red-start this is the log:

19 Jun 10:53:48 - [info] Node-RED version: v0.20.5
19 Jun 10:53:48 - [info] Node.js version: v10.16.0
19 Jun 10:53:48 - [info] Linux 4.19.42-v7+ arm LE
19 Jun 10:53:50 - [info] Loading palette nodes
19 Jun 10:53:57 - [info] Settings file : /home/pi/.node-red/settings.js
19 Jun 10:53:57 - [info] Context store : 'default' [module=memory]
19 Jun 10:53:57 - [info] User directory : /home/pi/.node-red
19 Jun 10:53:57 - [warn] Projects disabled : editorTheme.projects.enabled=false
19 Jun 10:53:57 - [info] Flows file : /home/pi/.node-red/flows_MQTT-NR.json
19 Jun 10:53:57 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

19 Jun 10:53:58 - [info] Starting flows
19 Jun 10:53:58 - [info] Started flows
19 Jun 10:53:58 - [info] Server now running at http://127.0.0.1:1880/
19 Jun 10:53:58 - [info] [ttn app:afaa156a.e2ae58] Connected to TTN application ttn-post
19 Jun 10:53:59 - [info] [ttn app:ad204910.e67f78] Connected to TTN application nap-lingemeer
19 Jun 10:53:59 - [info] [ttn app:b1ba9763.8396f8] Connected to TTN application dragino-nap

Well that all looks ok.
If you look at the info tab for the request node it describes how it interprets the message being fed to it. I wonder whether something in the message from the TTN node is confusing it. It might be worth inserting a function node between the TTN node and the request node that sends on an empty message to trigger the request, so maybe a function containing just
return {payload: ""}

1 Like

Thanks Colin, I'll insert the node as described if this issue happens again and see if it solves the problem then without resetting the RPi.

Also add a debug node showing what is coming from the TTN node, just to check that really is ok.

Thanks again!