# Blynk \<-\> Notehub Integration - Can't receive Location coordinates on Blynk datastream

**URL:** <https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416>\
**Category:** Notehub.io\
**Created:** [October 30, 2024, 12:01am UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416 "2024-10-30T00:01:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [October 30, 2024, 12:01am UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/1 "2024-10-30T00:01:59Z")

</div>

We’re testing out the official Notehub\<-\>Blynk integration and we are having problems relaying location data. All of the other datastreams are populating just fine, it’s only the location datastream that will not receive any coordinates.

I have a support thread in progress with Blynk support already, as I suspect the problem is on their end. They don’t seem to have it figured out yet however, so I thought I would mention it here in case someone on the Notehub team might be able to lend a hand in some way.

All of the details (and a few replies from Blynk support) are already in this thread: [Blues Notehub Integration - JSON format for sending 2 values (long,lat) to GPS datastream? - #6 by ironhalo2021 - Need Help With My Project - Blynk Community](https://community.blynk.cc/t/blues-notehub-integration-json-format-for-sending-2-values-long-lat-to-gps-datastream/72946/6)

Please let me know if you might have a clue what’s going on, or if you need more info to help troubleshoot it. I’m really hoping there is an easy solution to this, as we bought into the Blues ecosystem specifically because of the advertised Blynk integration. Unfortunately, without location data, the integration is a non-starter for us.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [October 31, 2024, 3:22pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/3 "2024-10-31T15:22:36Z")

</div>

UPDATE: We made a little progress with Blynk support on this, but only enough to know that…

1. The JSONata transform option definitely does not work for sending data to Blynk. (It appeared as though it was working initially, but only because the integration is apparently still sending the sensor data via sensors.qo in the background even when JSONata was selected as the payload.) Which makes me wonder why was the JSONata Expression option was not put in place in the integration? Having a transform method in between Notehub and Blynk would be incredibly useful, adding an option for augmenting data that doesn’t require MCU code.

2. The only way to get location data to Blynk is to have the MCU manually add it to a note file, such as: {“req”:“note.add”,“body”:{“location”: [1.11, 2.22]}}. If this is the case, how would we send the “best\_lon” and “best\_lat” data from the event API? And even if we can access those attributes, it seems rather inefficient for the MCU to be fetching those and feeding them back to the Notecard when those event attributes are already being sent with each sync by default. It would be really simple to alleviate the MCU from having to deal with location at all by using the following JSONata expression, but again the JSONata transform doesn’t seem to be working unfortunately…

```auto
{
"body": {
   "location": [best_lon, best_lat]
  }
}

```

Is this something that can be remedied?

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 31, 2024, 6:00pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/4 "2024-10-31T18:00:52Z")

</div>

Hey @josh77,

Sorry you ran into issues here. I’ll start with the good news: you don’t have to replicate the location logic in your MCU as JSONata has the ability to append the `best_lat` and `best_lon` to the `body` of your Notes. See [Using JSONata to Transform JSON - Blues Developers](https://dev.blues.io/guides-and-tutorials/notecard-guides/using-jsonata-to-transform-json/#merging-data-with-the-original-json-structure).

I just tried this JSONata out and it appended a `location` to the `body` in my webhook.site test route as expected.

```json
(
    $merge([$, {"body": $merge([body, { 
        "location": [best_lat, best_lon]
    }])}])
)

```

However, I did verify that for whatever strange reason these JSONata adjustments do not seem to be making it to Blynk specifically—which is… odd. I’m looking into it. Just wanted to let you know we saw this and appreciate the thorough report.

TJ

---

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [October 31, 2024, 7:15pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/5 "2024-10-31T19:15:49Z")

</div>

Confirmed, I am having great success getting the location data to webhook.site as well using JSONata. But yes, JSONata to Blynk is definitely the issue.

Thanks for confirming and looking into this TJ!

---

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [November 5, 2024, 4:29pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/6 "2024-11-05T16:29:18Z")

</div>

Hi TJ, just checking back in to see what you found out about making JSONata work with Blynk. The last thing Blynk support said in the other thread is that they would reach out to Blues to try to resolve it. Thanks!

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [November 5, 2024, 8:43pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/7 "2024-11-05T20:43:49Z")

</div>

Hey @josh77,

We’ve confirmed that the JSONata not applying is a bug on our end. I don’t have an exact date for a fix for you, but our cloud team is aware of the problem and it’s on their short list.

When I have an update I’ll reach out and let you know.

TJ

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [November 18, 2024, 5:13pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/8 "2024-11-18T17:13:31Z")

</div>

Hey @josh77,

Our fix for this went out on Friday. Sorry for the delay, and let us know if you hit any other issues.

TJ

---

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [November 18, 2024, 8:06pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/9 "2024-11-18T20:06:01Z")

</div>

Hey @tjvantoll ,

JSONata Transform is still not working for us with Blynk unfortunately. We’ve simplified our testing down to passing one single parameter. When we do a hub.sync, it transmits to Blynk successfully if we configure the route for ‘No Transformation’ (and we get a 200 success in the Route Log). However a sync fails to transmit to Blynk when we use a JSONata Expression (and we get a 400 error in the Route Log). I’ll attach some screenshots so you can see what’s going on.

I’m happy to do a screencast with one of your team members so they can see our test results in realtime if that’s helpful.

 ![Screen Shot 2024-11-18 at 2.56.23 PM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/2X/8/83ba43cdf2b474a3b907ab51b6210df3ee9e73c9.png)

 ![Screen Shot 2024-11-18 at 2.56.12 PM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/2X/a/aa428bc4f483bb009d9d3d291aa7e11f77b0e665.png)

 ![Screen Shot 2024-11-18 at 2.56.44 PM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/2X/6/69a4a92d0c10f64766d2d0612cbe9d4ece9a65eb.png)

 ![Screen Shot 2024-11-18 at 3.02.49 PM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/2X/0/0110c1b40883e66936531d2032339980e5cecec5.png)

 ![Screen Shot 2024-11-18 at 3.12.32 PM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/2X/5/58dfb7458c74211370b40dc2d8dddf2ddb1a691e.png)

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [November 19, 2024, 2:52pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/10 "2024-11-19T14:52:35Z")

</div>

Interesting. I was just able to recreate the 400 error you show above, but the JSONata I’ve been using to just add the location is working fine:

```json
(
    $merge([$, {"body": $merge([body, { 
        "location": [best_lat, best_lon]
    }])}])
)

```

My guess is Blynk requires some other bit of metadata in the Note and fails without it. I’ll keep testing.

TJ

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [November 19, 2024, 3:27pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/11 "2024-11-19T15:27:52Z")

</div>

Ok, it looks like all Blynk wants is just a `body` in the JSON, so this works.

```json
{
    "body": {
        "temp": body.temp
    }
}

```

TJ

---

<div class="post-metadata">

**Author:** ![josh77](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@josh77](https://discuss.blues.com/u/josh77)\
**Post date:** [November 19, 2024, 3:51pm UTC](https://discuss.blues.com/t/blynk-notehub-integration-cant-receive-location-coordinates-on-blynk-datastream/2416/12 "2024-11-19T15:51:30Z")

</div>

Awesome, I can confirm that works for us, and confirm that the location data is getting to Blynk as well, using this JSONata expression:

```auto
{
"body": {
   "temp": body.temp,
   "location": [best_lon, best_lat] // FYI - Blynk requires longitude before latitude
  }
}

```

Thanks very much TJ, I think we’re in business now. We appreciate you continuing to follow up on this until it was resolved.
