Unable to retrieve Location Metadata

Hi there,

I need some help with retrieving metadata from the Blynk console. There is a description on how to do this in the documentation, but it seems that it doesn’t work for location metadata.

I set up a metadata field of the type “location” in the Blynk console. This would allow end users to set a location for their device in the Blynk app.

To retrieve this location data on the ESP32, this was the code that I originally tried:


BLYNK_CONNECTED()
{
  Blynk.syncAll();
  Blynk.sendInternal("meta", "get", "Location");
}

BLYNK_WRITE(InternalPinMETA)
{
  String field = param[0].asStr();
  cloudMetaLocation = param[1].asStr();
}

Unfortunately, this outputs an empty string… After unsuccessfully trying to only retrieve the location field that I’m interested in, I added a text field in the metadata of the Blynk console section called “Test” and tried retrieving that:


BLYNK_CONNECTED()
{
  Blynk.syncAll();
  Blynk.sendInternal("meta", "get", "Location");
  Blynk.sendInternal("meta", "get", "Test");
}

BLYNK_WRITE(InternalPinMETA)
{
  String field = param[0].asStr();
  cloudMetaLocation = param[1].asStr();
}

This outputs the content of the “Test”-field only. So, is it possible that a “location-type” field in the Blynk console cannot be retrieved on the device? And if so, how can I allow the end user to set the device location in the app and make this information available to my ESP32?

Thanks a lot for your help.
Georg

Have you actually set a location for your device…

If not then a empty string is what I’d expect it to return.

Pete.

Yes, I provided a location. Any idea what I might have done wrong?

Best regards
Georg

It would probably help if you provided more information.

Pete.

ok no problem, but I don’t know what else I could provide. Could you tell me what you need?

Well, I’ve asked you a question and provided a screenshot, and you’ve replied “yes, I have”.
Some details might be good.
Details of what you get when you try using the REST API to retrieve the data might also be useful, but not if your reply is “same”.

Details of the Metadata IDs that you’ve cropped off of your screenshot might also be helpful.

Basically anything that helps to paint a full picture of what’s happening.

Pete.

I get your point and I’m trying to provide the info that you need.

Here’s a screenshot like yours which shows the metadata of the device:

As you can see, there is a value in the field “Test” which I can retrieve without problems. Do you know if it could be a datatype issue? I’m not sure what to expect when retrieving the location field. Is it a string which concatenates adress, zip code and city or is it coordinates?

I’m not actively using REST API so unfortunately I would need to know how to test it if that is an important information.

Best
Georg

here’s the uncropped screenshot:

So your template screen doesn’t show the metadata ID?…

It’s quite simple to use, this might help…

Pete.