Map widget cannot locate variable 'location' in the bucket

Map widget cannot locate variable 'location' in the bucket

@Steven Flaxman

Hi

I have successfully added a device and on update it has loaded all the variable to the bucket on TagoIO.

The devices uses the following payload formatter on the TTI

function Decoder(bytes, port)
{
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var decoded = {};

if (port === 1)
{
decoded.type = “position”;

decoded.latitude = bytes[0] + bytes[1] * 256 + bytes[2] * 65536 + bytes[3] * 16777216;
if (decoded.latitude >= 0x80000000)
  decoded.latitude -= 0x100000000;
decoded.latitude /= 1e7;
  
decoded.longitude = bytes[4] + bytes[5] * 256 + bytes[6] * 65536 + bytes[7] * 16777216;
if (decoded.longitude >= 0x80000000)
  decoded.longitude -= 0x100000000;
decoded.longitude /= 1e7;
  
//decoded.inTrip = ((bytes[8] & 0x1) !== 0) ? true : false;
//decoded.fixFailed = ((bytes[8] & 0x2) !== 0) ? true : false;
//decoded.headingDeg = (bytes[8] >> 2) * 5.625;
decoded.manDown=((bytes[8]&0x4)!==0)?true:false;
decoded.speedKmph = bytes[9];
decoded.batV = bytes[10] * 0.025;

//decoded.location = decoded.latitude + ',' + decoded.longitude;

}
else if (port === 2)
{
decoded.type = “downlink ack”;

decoded.sequence = (bytes[0] & 0x7F);
decoded.accepted = ((bytes[0] & 0x80) !== 0) ? true : false;
decoded.fwMaj = bytes[1];
decoded.fwMin = bytes[2];

}
else if (port === 3)
{
decoded.type = “stats”;

decoded.initialBatV    = (((bytes[0] & 0xF) !== 0) ? (4.0 + (bytes[0] & 0xF) * 0.100) : null);
decoded.txCount        =  32 * ((bytes[0] >> 4) + (bytes[1]  & 0x7F) *  16);
decoded.tripCount      =  32 * ((bytes[1] >> 7) + (bytes[2]  & 0xFF) *   2
                                                + (bytes[3]  & 0x0F) * 512);
decoded.gpsSuccesses   =  32 * ((bytes[3] >> 4) + (bytes[4]  & 0x3F) *  16);
decoded.gpsFails       =  32 * ((bytes[4] >> 6) + (bytes[5]  & 0x3F) *   4);
decoded.aveGpsFixS     =   1 * ((bytes[5] >> 6) + (bytes[6]  & 0x7F) *   4);
decoded.aveGpsFailS    =   1 * ((bytes[6] >> 7) + (bytes[7]  & 0xFF) *   2);
decoded.aveGpsFreshenS =   1 * ((bytes[7] >> 8) + (bytes[8]  & 0xFF) *   1);
decoded.wakeupsPerTrip =   1 * ((bytes[8] >> 8) + (bytes[9]  & 0x7F) *   1);
decoded.uptimeWeeks    =   1 * ((bytes[9] >> 7) + (bytes[10] & 0xFF) *   2);

}

return decoded;
}

// add other functions (Converter, Validator) here if you used them. If you didn’t you can just skip them.

function decodeUplink(input) {
var data = input.bytes;
var valid = true;

if (typeof Decoder === “function”) {
data = Decoder(data, input.fPort);
}

if (typeof Converter === “function”) {
data = Converter(data, input.fPort);
}

if (typeof Validator === “function”) {
valid = Validator(data, input.fPort);
}

if (valid) {
return {
data: data
};
} else {
return {
data: {},
errors: [“Invalid data received”]
};
}
}

After device update the variable Latitude and Longitude appear in the bucket. As seen below

My problem is that the variable ‘location’ is not created by TagoIO internal process as the following documentation from TagoIO indicates.

TagoIO converts the latitude and longitude fields to the specific format so you don’t have to worry about any conversions. In order to accomplish that, you only need to have the variables latitude and longitude or lat and lng , and TagoIO will automatically get these values variables and create a new variable called location .

After you get your device to send the latitude and longitude information to TagoIO, create a dashboard and add a Map widget. Look for the device, and add the variable ’ location ’ inside the map.

I created my Map widget and added the devices with variable location,

But the devices are not displayed

MapDisplay

Am i doing something wrong. I have done this many time before with no problems. Is it because i am ussing TTI rather than TTN.

Any help appriciated.
Thanks
Flaxies.