MartinKemper / LoRaWAN-Mapper

28 stars 6 forks source link

Update Node-Red flows for TTN V3 #2

Open DavidJRichards opened 2 years ago

DavidJRichards commented 2 years ago

I wanted to try this with my TTGO T-beam tracker but first needed to update the Node-RED flow to suit TTN V3. Here is a link to the new flow: https://github.com/DavidJRichards/Lora_TTN/blob/main/LoRaWAN-Mapper/flows.json Kind regards, David.

ghost commented 2 years ago

Hey DavidJRichards,

Since TTN V3 I have problems with the LoRaWAN Mapper too. Unfortunately your link to the new Flow can not be found on Github anymore. Kind regards, Vanessa

DavidJRichards commented 2 years ago

Hi Vanessa, I'm sorry but I forgot I'd made the repo private. I'll review the flow and post it here if you are still interested. David.

ghost commented 2 years ago

Hey David,

 

No need for excusing yourself. It would be nice if you could review the flow for all people who are struggling since V3.

Regards.

   

Gesendet: Montag, 17. Januar 2022 um 20:39 Uhr Von: "DavidJRichards" @.> An: "MartinKemper/LoRaWAN-Mapper" @.> Cc: "vmandel" @.>, "Comment" @.> Betreff: Re: [MartinKemper/LoRaWAN-Mapper] Update Node-Red flows for TTN V3 (Issue #2)

 

Hi Vanessa, I'm sorry but I forgot I'd made the repo private. I'll review the flow and post it here if you are still interested. David.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

DavidJRichards commented 2 years ago

LoRaWAN-Mapper

Update to TTN V3 for LoRaWan-Mapper

Influx database

configuration

$influx
>CREATE DATABASE ttndata
>CREATE USER admin WITH PASSWORD 'admin' WITH ALL PRIVILEGES

inspect data

$influx
>USE ttndata
>SELECT * from loradbmapper
name: loradbmapper
time                BW     RSSI_DL SF SNR_DL application counter geohash   lat                lon                 name
----                --     ------- -- ------ ----------- ------- -------   ---                ---                 ----
1638467101717091466 125000 -43     7  13.5   djrm-test   423     gcxs05hf0 54.4671362321   -0.5697226863767 eui-70b3d57ed0046f5c
1638467161141918985 125000 -44     7  13.5   djrm-test   424     gcxs05hcg 54.43494972199  -0.440976645988  eui-70b3d57ed0046f5c
1638467221307107405 125000 -45     7  10     djrm-test   425     gcxs05hct 54.402763211905 -0.3551459523956 eui-70b3d57ed0046f5c
1638467341417688253 125000 -43     7  13.8   djrm-test   427     gcxs05hcu 54.4456785587   -0.3980612991918 eui-70b3d57ed0046f5c

Node-RED configuration

[
    {
        "id": "d99d43e6.a7146",
        "type": "geohash",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "property": "payload",
        "x": 500,
        "y": 760,
        "wires": [
            [
                "76311898.7b9db8",
                "53e4013d.812dc"
            ]
        ]
    },
    {
        "id": "76311898.7b9db8",
        "type": "function",
        "z": "7cf72ffc.4abd6",
        "name": "Parse in Geohash",
        "func": "var thing = [{\n\n    lat:msg.payload.lat, \n    \n    lon:msg.payload.lon,\n    \n    application:msg.payload.application,\n    \n    counter:msg.payload.counter,\n    \n    SF:msg.payload.SF,\n    \n    BW:msg.payload.BW,\n    \n    RSSI_DL:msg.payload.RSSI_DL,\n    \n    SNR_DL:msg.payload.SNR_DL,\n        \n},\n\n{\n\n  geohash:msg.payload.geohash,\n  \n  name:msg.payload.name\n  \n}\n\n]\n\nmsg.payload = thing;\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 650,
        "y": 820,
        "wires": [
            [
                "c6759167.9775b",
                "dc53571f.6e6a28"
            ]
        ]
    },
    {
        "id": "dc53571f.6e6a28",
        "type": "influxdb out",
        "z": "7cf72ffc.4abd6",
        "influxdb": "5bca9865.fc2068",
        "name": "loradbmapper",
        "measurement": "loradbmapper",
        "precision": "",
        "retentionPolicy": "",
        "database": "database",
        "precisionV18FluxV20": "ms",
        "retentionPolicyV18Flux": "",
        "org": "organisation",
        "bucket": "bucket",
        "x": 920,
        "y": 880,
        "wires": []
    },
    {
        "id": "c6759167.9775b",
        "type": "debug",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 820,
        "wires": []
    },
    {
        "id": "53e4013d.812dc",
        "type": "debug",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 760,
        "wires": []
    },
    {
        "id": "aedddbef.857328",
        "type": "function",
        "z": "7cf72ffc.4abd6",
        "name": "Payload Parser",
        "func": "var port=msg.payload.uplink_message.f_port;\nvar thing = {\n\n    name: msg.payload.end_device_ids.device_id, \n    \n    lat: msg.payload.uplink_message.decoded_payload.latitude, \n    \n    lon: msg.payload.uplink_message.decoded_payload.longitude,\n    \n    application:msg.payload.end_device_ids.application_ids.application_id,\n    \n    counter:msg.payload.uplink_message.f_cnt,\n    \n    SF:msg.payload.uplink_message.settings.data_rate.lora.spreading_factor,\n    \n    BW:msg.payload.uplink_message.settings.data_rate.lora.bandwidth,   \n    \n    RSSI_DL:msg.payload.uplink_message.rx_metadata[0].rssi,\n    \n    SNR_DL:msg.payload.uplink_message.rx_metadata[0].snr,\n    \n}\n\nif(port != 10)\n    return;\n\nmsg.payload = thing;\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 700,
        "wires": [
            [
                "d99d43e6.a7146",
                "32694e5a.941cb2"
            ]
        ]
    },
    {
        "id": "32694e5a.941cb2",
        "type": "debug",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 700,
        "wires": []
    },
    {
        "id": "1ed75ab6.6024b5",
        "type": "mqtt in",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "topic": "v3/djrm-test@ttn/devices/eui-70b3d57ed0046f5c/up",
        "qos": "0",
        "datatype": "json",
        "broker": "429a5482.a7189c",
        "nl": false,
        "rap": false,
        "x": 310,
        "y": 120,
        "wires": [
            [
                "ffd3f5f0.ba1428",
                "a2c62744.465738",
                "aedddbef.857328"
            ]
        ]
    },
    {
        "id": "a2c62744.465738",
        "type": "debug",
        "z": "7cf72ffc.4abd6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 120,
        "wires": []
    },
    {
        "id": "5bca9865.fc2068",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "ttndata",
        "name": "loradbmapper",
        "usetls": false,
        "tls": "c149cddf.15d68",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    },
    {
        "id": "429a5482.a7189c",
        "type": "mqtt-broker",
        "name": "djrm-test@ttn",
        "broker": "eu1.cloud.thethings.network",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "c149cddf.15d68",
        "type": "tls-config",
        "name": "",
        "cert": "",
        "key": "",
        "ca": "",
        "certname": "",
        "keyname": "",
        "caname": "",
        "servername": "",
        "verifyservercert": false
    }
]