How to modify ChirpStack Simulator upLink payload?

Hi All,

This is likely a GO-specific question, but as this is the place for all things Chirp I would like to get the opinion from people who have the know-how in both.
I am trying to do some modification to the simulator files in order to add some more values as I am looking to build some dashboards through the ThingsBoard integration.

I have tried adding more context to location in the simulator.go file as below

This addition is giving me a “missing type in composite literal” error. Can anyone tell me why that might be?

Also, I am also looking to add extra location information to the uplink messages (again for my TB dashboards) I was hitting a similar error in the gateway.go file image I’m sure if anyone can answer for the first image, it will probably give the answer for the second image.

Any help that anyone can give is greatly appreciated

Hii @Jake_Murphy

You need to import the below library in your go file

"github.com/brocaar/chirpstack-api/go/v3/common"

gateway.go file

pl.RxInfo = &gw.UplinkRXInfo{
        GatewayId: g.gatewayID[:],
        Rssi:      50,
        LoraSnr:   5.5,
        Context:   []byte{0x01, 0x02, 0x03, 0x04},
        UplinkId:  uplinkID[:],
        Location:  &common.Location{
            Latitude: 43.0001,
            Longitude: 11.2324,
            Altitude: 12,
        },
    }

Hi @sagarpatel

Thank you so much for the help. I figured out to put the key: value pairs in the Location object, but I was only doing it in simulator.go, you reminded me to put it into gateway.go, and it will probably make things cleaner.

The next problem I’ve hit is one that I think I already know the answer to, but I want to check with you anyway. I am now trying to add extra fields to capture some of the data I want to get from my devices (eg battery, humidity, velocity) Would I need to clone that chirpstack-api repo and modify the file in ‘common’ myself, or is there some way to add this value without that effort?

example

pl.RxInfo = &gw.UplinkRXInfo{
	GatewayId: g.gatewayID[:],
	Rssi:      25,
	LoraSnr:   5.5,
	Context:   []byte{0x01, 0x02, 0x03, 0x04},
	UplinkId:  uplinkID[:],
	Location: &common.Location{Latitude: 53.3246897116735, Longitude: -6.33524010119518, Altitude: 11.2,},
	Channel:   7,
	Board:     2,
	Antenna:   3,
    Battery:   45,
    Humidity: 35,
    Velocity: 24,
}