Read Metadata values of Location or Text

It seems that you have a Location metadata type called Location, and have added a Coordinates metadata type also called Location, which has no coordinate values in it.

Did you add some coordinates, and did you change your sketch to reflect the new name?

Pete.

Yes sir tried

if not possible,
tell m how t read it using http api

@VIGHNESHNS2008 do you have some data assigned to the location metafield of the specific device?Do you get some response at all? Or you get empty response?

yes assigned value.

empty response

@Dmitriy I’ve been doing a bit of testing, and ther seems to be an issue with coordinates…

Metadata setup:

Map Coordinates is populated as follows:

Test code…

BLYNK_CONNECTED()
{
  // Send requests for different metadata
  Blynk.sendInternal("meta", "get", "Board Type");
  Blynk.sendInternal("meta", "get", "Device Location");
  Blynk.sendInternal("meta", "get", "Map Coordinates");  
}

BLYNK_WRITE(InternalPinMETA) {
    String field = param[0].asStr();
    
    if (field == "Board Type")
    {
      String value = param[1].asStr();
      Serial.print("Board Type = ");
      Serial.println(value);
    }
    
    if (field == "Device Location")
    {
      String value = param[1].asStr();      
      Serial.print("Device Loaction = ");
      Serial.println(value);        
    }

    if (field == "Map Coordinates")
    {
      String value = param[1].asStr();      
      Serial.print("Map Coordinates = ");
      Serial.println(value);
    }
}

Serial Output…

[2652] Connecting to blynk.cloud:443
[3529] Certificate OK
[3540] Ready (ping: 10ms).

Board Type = ESP32 DevBoard
Device Loaction = The desk in my office
Map Coordinates = 

Note that Map Coordinates is blank (or 0.00 if I change to Float).

I also tried param[2].asStr() and param[3].asStr() in the hope that Latitude and Longitude were hidden in there, but no joy.

Also, when you view the Device metadata, the field names are capitalised…

image

which could get confusing.

Pete.

I tried writing values. Wks fine. but reading is a problem

Same Issue for Me

Yes. You’re right. Not all fields yet supported. I forgot about that. I’ll fix this.

1 Like

ok.
And… has that unexpeted error fixed?

@VIGHNESHNS2008 location meta reading should work now. Please check.

Yes. Do you still see any errors?

Ok, wil try in some time and reply

Getting only lattitude
no longitud, text, state, zip etc.

Edit: Sorry Mistake

How do you read the data?

Could you please show it?

From device
By the way I am reading the prebuilt location metadata.

ANy clues?

Please show your code… Otherwise i can only guess.

//
//// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME           "Device"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD

#include "BlynkEdgent.h"

void setup()
{
  Serial.begin(115200);
  delay(100);

  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
}
BLYNK_WRITE(InternalPinMETA) {
    String field = param[0].asStr();
Serial.println(field);
    if (field == "Location") {
        String value = param[1].asStr();

Serial.println(value);
        // Do something with Metadata value
    } 
}
BLYNK_CONNECTED() {
  // Send requests for different metadata
  Blynk.sendInternal("meta", "get", "Location");
//  Blynk.sendInternal("meta", "get", "Device Model");
}


Meta setup- just random values for testi ng

@VIGHNESHNS2008 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

So you read the first param lon, in order to read the next one you need to use param[2].asStr(). Right only lon/lat is supported. It was done for one of the clients. I’ll check if can attach more data.