ttnmapper / bugtracker

File all bugs and feature requests as issues on this repo please
0 stars 0 forks source link

Chirpstack v4 integration #19

Open aschliemann opened 1 year ago

aschliemann commented 1 year ago

Hi, chirpstack has updated to v4. https://www.chirpstack.io/docs/ I tried the integration as suggested with your documentation. As far as I know Orne Brocaar tried to make chirpstack more ttn syntax like (at least the device decoders are). The data object is also different from before.

See https://www.chirpstack.io/docs/chirpstack/integrations/events.html for updated event data-structure: e.g. see up-event - mind the object-object: { "deduplicationId": "3ac7e3c4-4401-4b8d-9386-a5c902f9202d", "time": "2022-07-18T09:34:15.775023242+00:00", "deviceInfo": { "tenantId": "52f14cd4-c6f1-4fbd-8f87-4025e1d49242", "tenantName": "ChirpStack", "applicationId": "17c82e96-be03-4f38-aef3-f83d48582d97", "applicationName": "Test application", "deviceProfileId": "14855bf7-d10d-4aee-b618-ebfcb64dc7ad", "deviceProfileName": "Test device-profile", "deviceName": "Test device", "devEui": "0101010101010101", "tags": { "key": "value" } }, "devAddr": "00189440", "dr": 1, "fPort": 1, "data": "qg==", "object": { "latitude":0.00, "longitude":0.00, "altitude":0.00, "hdop":0, "satellites":0 }, "rxInfo": [{ "gatewayId": "0016c001f153a14c", "uplinkId": 4217106255, "rssi": -36, "snr": 10.5, "context": "E3OWOQ==", "metadata": { "region_name": "eu868", "region_common_name": "EU868" } }], "txInfo": { "frequency": 867100000, "modulation": { "lora": { "bandwidth": 125000, "spreadingFactor": 11, "codeRate": "CR_4_5" } } } }

BEFORE (version 3. https://www.chirpstack.io/application-server/integrations/events/ ) it has been like this - mind the objectJSON-string : { "applicationID": "123", "applicationName": "temperature-sensor", "deviceName": "garden-sensor", "devEUI": "AgICAgICAgI=", "rxInfo": [ { "gatewayID": "AwMDAwMDAwM=", "time": "2019-11-08T13:59:25.048445Z", "timeSinceGPSEpoch": null, "rssi": -48, "loRaSNR": 9, "channel": 5, "rfChain": 0, "board": 0, "antenna": 0, "location": { "latitude": 52.3740364, "longitude": 4.9144401, "altitude": 10.5 }, "fineTimestampType": "NONE", "context": "9u/uvA==", "uplinkID": "jhMh8Gq6RAOChSKbi83RHQ==" } ], "txInfo": { "frequency": 868100000, "modulation": "LORA", "loRaModulationInfo": { "bandwidth": 125, "spreadingFactor": 11, "codeRate": "4/5", "polarizationInversion": false } }, "adr": true, "dr": 1, "fCnt": 10, "fPort": 5, "data": "...", "objectJSON": "{\"latitude\":0.00, \"longitude\":0.00, \"altitude\":0.00, \"hdop\":0, \"satellites\":0}", "tags": { "key": "value" } }

already checked:

jpmeijers commented 1 year ago

We will have to add a new api endpoint to the TTN Mapper ingress API which handles the V4 json format. I'm not sure when I'll get around doing this.

What would help me a lot is some example uplink json events from real world networks. Access to a V4 network, application and device would be very helpful too.

aschliemann commented 1 year ago

OK, I have now used tcpdump -vv -e -A to get a real life example. So, this should be exactly how the communication reaches the ttnmapper. I changed some ID (mostly to 0) and hostnames/etc for privacy. I hope this is what you requested - otherwise contact me again. Thanks!

POST /path_to_api?event=up HTTP/1.1
ttnmapperorg-experiment: someexperihentname
ttnmapperorg-network: somenetworkname
ttnmapperorg-user: someuser@email.com
content-type: application/json
accept: */*
host: [hostname:portnumber](http://hostname:portnumber/)
content-length: 1462

{
  "deduplicationId": "00000000-0000-0000-0000-000000000000",
  "time": "2023-01-04T12:11:30.330+00:00",
  "deviceInfo": {
    "tenantId": "00000000-0000-0000-0000-000000000000",
    "tenantName": "name of tenant",
    "applicationId": "00000000-0000-0000-0000-000000000000",
    "applicationName": "FeldtesterAdeunis",
    "deviceProfileId": "00000000-0000-0000-0000-000000000000",
    "deviceProfileName": "FieldTester_ABP",
    "deviceName": "FeldtesterAdeunis",
    "devEui": "0000000000000000",
    "tags": {
      "owner": "ownername",
      "user": "username"
    }
  },
  "devAddr": "00000000",
  "adr": false,
  "dr": 2,
  "fCnt": 29,
  "fPort": 1,
  "confirmed": false,
  "data": "SOMEDATASTRING",
  "object": {
    "altitude": 0,
    "sats": 5,
    "longitude": 10.001333333333333,
    "gps_quality": "Good",
    "hdop": 1,
    "battery_level": 3.954,
    "latitude": 49.831183333333335,
    "satellites": 5
  },
  "rxInfo": [
    {
      "gatewayId": "SOMEGATEWAYEUI",
      "uplinkId": 2629385239,
      "timeSinceGpsEpoch": "1356869508.330s",
      "rssi": -113,
      "snr": -5.2,
      "channel": 7,
      "board": 263,
      "location": {
        "latitude": 49.79276657104492,
        "longitude": 9.994033813476562,
        "altitude": 288
      },
      "context": "yfHDjA==",
      "metadata": {
        "region_name": "eu868",
        "region_common_name": "EU868"
      }
    }
  ],
  "txInfo": {
    "frequency": 868500000,
    "modulation": {
      "lora": {
        "bandwidth": 125000,
        "spreadingFactor": 10,
        "codeRate": "CR_4_5"
      }
    }
  }
}