Hi - I’m a competent javascript developer but a NOOB with IOT - I’m trying to get a couple of values from a sensor from TNN to a web visualization I built, and my first attempt was to try and follow the tutorials for Node-RED / IFTTT integrations - the idea being hopefully once it’s in IFTTT I have a few more options with tools I’m familiar with for retrieving the data via a JS API endpoint.
First off - is this a reasonable approach? I’m guessing there’s probably a way to get it straight from Node RED but I haven’t found it yet.
Second, in my attempt to set this up, I’m getting a “Forward Uplink Data Message” which successfully shows the data from my sensor. In particular the value I’m after is data.uplink_message.decoded_payload.ble
I added a webhook integration in TNN of the format: JSON, URL: http://127.0.0.1:1880
(the address that Node-RED exposes when I run it on my machine), and for the enabled event types I’ve selected uplink message
raphael-paxcounter
I followed the diagram for the node setup in node-red, with an http node with url raphael-paxcounter
, a function that looks like
msg.url = "https://maker.ifttt.com/trigger/raphael-paxcounter/with/key/[my_key]"
msg.method = "POST";
msg.payload = {
'ble' : msg.payload.uplink_message.decoded_payload["ble"],
'wifi' : msg.payload.uplink_message.decoded_payload["wifi"]
}
return msg;
and followed the rest of the tutorial for the other nodes, wired up without changes.
The data logs to TNN properly, and I know the payload I want to receive.
I start node red which exposes http://127.0.0.1:1880/
My particular flow in node red has a URL of http://localhost:1880/#flow/5086e3421505115e
The startup output in terminal for node-red is attached, as is the error I’m getting in the things network for my integration:
Fail to send webhook
"name": "as.webhook.fail",
"cause": {
"namespace": "pkg/errors",
"name": "net_operation",
"message_format": "net operation failed",
"attributes": {
"address": "127.0.0.1:1880",
"net": "tcp",
"op": "dial",
"timeout": false
},
"correlation_id": "49c1eac9147c4628aa0b0e4f1b9c09b8",
"code": 14
any idea how to get unstuck? Or any resources that show an alternative tutorial where data can be set up to be accessed via the web?
Thanks!
This is what the data looks like coming into TNN:
{
"name": "as.up.data.forward",
"time": "2022-06-26T00:49:10.704078328Z",
"identifiers": [
{
"device_ids": {
"device_id": "eui-70b3d57ed0051779",
"application_ids": {
"application_id": "paxcounter-raphael"
},
"dev_eui": "70B3D57ED0051779",
"join_eui": "0000000000000000",
"dev_addr": "260CE2C8"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
"end_device_ids": {
"device_id": "eui-70b3d57ed0051779",
"application_ids": {
"application_id": "paxcounter-raphael"
},
"dev_eui": "70B3D57ED0051779",
"join_eui": "0000000000000000",
"dev_addr": "260CE2C8"
},
"correlation_ids": [
"as:up:01G6EQQRDN9TQ4TGWN0YTCTS8G",
"gs:conn:01G69BA3NCXQTHA6AXHJZ7JVQX",
"gs:up:host:01G69BA3SZRKDNXRBDE3401T3T",
"gs:uplink:01G6EQQR6VW24P6CBHNVXYNDC0",
"ns:uplink:01G6EQQR6XW5XHCQMW6S30T1C7",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01G6EQQR6WRTARCBFNXEDA641S",
"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01G6EQQRDFHY52ECFQKNA0G8W2"
],
"received_at": "2022-06-26T00:49:10.582007349Z",
"uplink_message": {
"session_key_id": "AYGdX/BwY710zXsC1fv1ZA==",
"f_port": 9,
"f_cnt": 41,
"frm_payload": "/w==",
"decoded_payload": {
"timesync_seqno": 255
},
"rx_metadata": [
{
"gateway_ids": {
"gateway_id": "ptldorah1",
"eui": "50544C444F524148"
},
"time": "2022-06-26T00:49:10.338742Z",
"timestamp": 323289340,
"rssi": -116,
"channel_rssi": -116,
"snr": -12.5,
"uplink_token": "ChcKFQoJcHRsZG9yYWgxEghQVExET1JBSBD8gZSaARoMCIba3pUGEJ2KsK0BIOCwr6y0iCoqDAiG2t6VBhDwlcOhAQ==",
"channel_index": 3
}
],
"settings": {
"data_rate": {
"lora": {
"bandwidth": 125000,
"spreading_factor": 10
}
},
"coding_rate": "4/5",
"frequency": "904500000",
"timestamp": 323289340,
"time": "2022-06-26T00:49:10.338742Z"
},
"received_at": "2022-06-26T00:49:10.365057053Z",
"consumed_airtime": "0.288768s",
"version_ids": {
"brand_id": "opensource",
"model_id": "esp32-paxcounter",
"hardware_version": "_unknown_hw_version_",
"firmware_version": "2.4.0",
"band_id": "US_902_928"
},
"network_ids": {
"net_id": "000013",
"tenant_id": "ttn",
"cluster_id": "nam1",
"cluster_address": "nam1.cloud.thethings.network"
}
}
},
"correlation_ids": [
"as:up:01G6EQQRDN9TQ4TGWN0YTCTS8G",
"gs:conn:01G69BA3NCXQTHA6AXHJZ7JVQX",
"gs:up:host:01G69BA3SZRKDNXRBDE3401T3T",
"gs:uplink:01G6EQQR6VW24P6CBHNVXYNDC0",
"ns:uplink:01G6EQQR6XW5XHCQMW6S30T1C7",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01G6EQQR6WRTARCBFNXEDA641S",
"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01G6EQQRDFHY52ECFQKNA0G8W2"
],
"origin": "ip-10-101-13-137.us-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_APPLICATION_TRAFFIC_READ"
]
},
"unique_id": "01G6EQQRHG8JYJ5AD753QYZQ8E"
}
I also attached the error I get on the webhooks integration screen:
“this webhook has been deactivated due to several unsuccessful forwarding attempts”