# How to set LoRa TTN node to trigger another node?

**URL:** <https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365>\
**Category:** General\
**Created:** [18 June 2019 16:16 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365 "2019-06-18T16:16:34Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 June 2019 16:16 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/1 "2019-06-18T16:16:34Z")

</div>

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?

 ![forum](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f9d21e7c51d5013dfdbde7d4368feada082a7ab3.png)

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [18 June 2019 16:24 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/2 "2019-06-18T16:24:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 June 2019 16:31 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/3 "2019-06-18T16:31:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 June 2019 16:38 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/4 "2019-06-18T16:38:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 June 2019 16:52 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/5 "2019-06-18T16:52:59Z")

</div>

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 😉

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!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 June 2019 17:39 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/6 "2019-06-18T17:39:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 June 2019 18:53 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/7 "2019-06-18T18:53:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [19 June 2019 06:20 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/8 "2019-06-19T06:20:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 June 2019 07:06 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/9 "2019-06-19T07:06:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [19 June 2019 07:23 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/10 "2019-06-19T07:23:03Z")

</div>

Not that I know:

 ![forum](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ea47245c72be0d428ee82cfbf00e506b7b3f7624.jpeg)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 June 2019 09:40 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/11 "2019-06-19T09:40:34Z")

</div>

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

```auto
node-red-stop
node-red-start

```

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [19 June 2019 09:57 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/12 "2019-06-19T09:57:21Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 June 2019 10:49 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/13 "2019-06-19T10:49:15Z")

</div>

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: ""}`

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [19 June 2019 11:47 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/14 "2019-06-19T11:47:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 June 2019 11:51 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/15 "2019-06-19T11:51:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [19 June 2019 12:25 UTC](https://discourse.nodered.org/t/how-to-set-lora-ttn-node-to-trigger-another-node/12365/16 "2019-06-19T12:25:18Z")

</div>

Thanks again!
