Display device name on map

Display device name on map

@Andrew Sevil

Hi everyone, I’m trying to show the name of the device on the map widget, but am not sure how to incorporate it into my payload parser…if that’s the way to even do it…
The gps device is correctly set up and is showing location of device on the map.
What I would like is for the Device to show the name…where “Mocha” is in the image below.
image
Here is my payload parser, showing where I need the device_name to be referenced.

console.log(payload);

const payload_raw = raw_payload.find(x => x.variable === ‘ttn_payload’);

if(payload_raw){

try {

const payload_data = JSON.parse(payload_raw.value);

const data = [

  { variable: 'heading', value: payload_data.payload_fields.headingDeg },

  { variable: 'speed', value: payload_data.payload_fields.speedKmph, unit: 'km/h' },

  { variable: 'battery_voltage', value: payload_data.payload_fields.batV, unit: 'V' },

  { variable: 'location', value: 'need device_name here', location: { lat: payload_data.payload_fields.latitudeDeg, lng:  payload_data.payload_fields.longitudeDeg } },

  ]

 payload = data;

} catch (e) {

// Print the error to the Live Inspector.

console.error(e);

// Return the variable parse_error for debugging.

payload = [{ variable: 'parse_error', value: e.message }];

}

}