Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata for gateway in Chirpstack #285

Open
jpmeijers opened this issue Dec 26, 2023 · 4 comments
Open

Metadata for gateway in Chirpstack #285

jpmeijers opened this issue Dec 26, 2023 · 4 comments

Comments

@jpmeijers
Copy link
Contributor

This is both a question and a feature request.

In ChirpStack I see the following Up Event:

{
    "deduplicationId": "e3eb5131-fb38-481a-b9df-003d0bee6c93",
    "time": "2023-12-22T11:56:17.743353+00:00",
    "deviceInfo": {
        "tenantId": "<REDACTED>",
        "tenantName": "JP Meijers",
        "applicationId": "<REDACTED>",
        "applicationName": "JP Sensecap T1000",
        "deviceProfileId": "<REDACTED>",
        "deviceProfileName": "SenseCap T1000 Roaming",
        "deviceName": "JP T1000",
        "devEui": "<REDACTED>",
        "deviceClassEnabled": "CLASS_A",
        "tags": {}
    },
    "devAddr": "fe00483c",
    "adr": true,
    "dr": 5,
    "fCnt": 463,
    "fPort": 0,
    "confirmed": false,
    "data": "",
    "rxInfo": [
        {
            "gatewayId": "3133303748005c00",
            "uplinkId": 45825,
            "gwTime": "2023-12-22T11:56:17.743353+00:00",
            "nsTime": "2023-12-22T11:56:28.549616823+00:00",
            "rssi": -67,
            "snr": 9.5,
            "channel": 6,
            "location": {
                "latitude": -33.95476966725685,
                "longitude": 22.434511184692386
            },
            "context": "rxh28g==",
            "metadata": {
                "region_config_id": "eu868",
                "region_common_name": "EU868"
            },
            "crcStatus": "CRC_OK"
        },
        {
            "gatewayId": "2eccbd518b5ad386",
            "uplinkId": 38534,
            "gwTime": "2023-12-22T11:56:28+00:00",
            "nsTime": "2023-12-22T11:56:28.710719511+00:00",
            "rssi": -67,
            "snr": 9.5,
            "context": "rxh28g==",
            "metadata": {
                "region_config_id": "eu868",
                "gateway_h3index": "8cbc4571e64d3ff",
                "regi": "EU868",
                "region_common_name": "EU868",
                "gateway_name": "nice-silver-shell",
                "gateway_id": "14U81Dp3D3jWFiQb6qJrCTRD3DBnii9Q9QGS6pWrNUuoV4bZn8D",
                "gateway_lat": "-33.954563040285272",
                "gateway_long": "22.434591229611467"
            },
            "crcStatus": "CRC_OK"
        }
    ],
    "txInfo": {
        "frequency": 867700000,
        "modulation": {
            "lora": {
                "bandwidth": 125000,
                "spreadingFactor": 7,
                "codeRate": "CR_4_5"
            }
        }
    }
}

Under rxInfo, the second object is a Helium IoT Hotspot, while the first one is directly connected to Chirpstack.

Under metadata for the Helium hotspot, there are a couple of fields, all pretty self explanatory.

Questions:

  • Q1: Where are the field names for the Helium hotspot's metadata defined? Is it in ?
  • Q2: "gatewayId": "2eccbd518b5ad386",, from the sourcecode above this looks like it's the Base58 of the Helium Gateway ID (aka PubKey). But I can't reproduce this. Can anyone help/explain please?

Requests:

  • Request 1: Can we add a field in the metadata that explicitly states this gateway is part of Helium? Something like "network": "helium_iot",
  • Request 2: Can we populate the proper rxInfo->location object with the Hotspot's coordinates, so we can rely on standard ChirpStack endpoints to consume the location?
@michaeldjeffrey
Copy link
Contributor

Q1: Where are the field names for the Helium hotspot's metadata defined? Is it in

BaseMeta = #{
gateway_id => B58,
gateway_name => Name,
regi => hpr_packet_up:region(Up)
},
?

Those are the Meta fields that will always exist.

BaseMeta#{
gateway_h3index => erlang:list_to_binary(h3:to_string(H3Index)),
gateway_lat => hpr_utils:format_coord(Lat),
gateway_long => hpr_utils:format_coord(Long)
}

These fields will be added if the gateways has a location.

@michaeldjeffrey
Copy link
Contributor

Q2: "gatewayId": "2eccbd518b5ad386",, from the sourcecode above this looks like it's the Base58 of the Helium Gateway ID (aka PubKey). But I can't reproduce this. Can anyone help/explain please?

There are 2 gateway ids.

The MAC cannot be reversed into the b58, which is why it's also provided.

@michaeldjeffrey
Copy link
Contributor

Request 1: Can we add a field in the metadata that explicitly states this gateway is part of Helium? Something like "network": "helium_iot",

Thanks for the PR 👍

@michaeldjeffrey
Copy link
Contributor

Request 2: Can we populate the proper rxInfo->location object with the Hotspot's coordinates, so we can rely on standard ChirpStack endpoints to consume the location?

rxInfo->location is populated by the stat object in a PUSH_DATA frame.

The Packet Routers cannot fill out a stat object, and the location information are the only optional fields in the object, so it was removed. #271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants