# \[App\]\[Pro\] Local API

**URL:** <https://community.homey.app/t/app-pro-local-api/70840>\
**Category:** Apps\
**Tags:** app, flow, homey-pro\
**Created:** [October 19, 2022, 3:50pm UTC](https://community.homey.app/t/app-pro-local-api/70840 "2022-10-19T15:50:01Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ilpaolino](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ilpaolino/32/49565_2.png) [@ilpaolino](https://community.homey.app/u/ilpaolino)\
**Post date:** [November 28, 2022, 9:09pm UTC](https://community.homey.app/t/app-pro-local-api/70840/21 "2022-11-28T21:09:57Z")

</div>

New version in test: 1.1.2  
Can you try again?

> **[Local API](https://homey.app/it-it/app/dev.dadda.localapi/Local-API/)**
>
> Creatore di API locali hostato e servito dal tuo Hub Homey

Thank you

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [January 22, 2023, 3:56pm UTC](https://community.homey.app/t/app-pro-local-api/70840/22 "2023-01-22T15:56:02Z")

</div>

This should be an amazingly useful app but I’m having a frustrating issue with the format of the JSON for the response. When I create this flow:

 ![Screenshot 2023-01-22 at 15.54.10](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/8604b8f0e14de42121f06dbe0706ebaaa1826ca9.png)

I get this response:

```auto
{
  "status": "success",
  "url": "/test",
  "method": "GET",
  "data": {
    "status": "error",
    "message": "Invalid JSON"
  }
}

```

I have tried many many variations for how to enter the JSON but cannot for the life of me find one that the app considers to be valid JSON. Any help gratefully received!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [January 22, 2023, 4:12pm UTC](https://community.homey.app/t/app-pro-local-api/70840/23 "2023-01-22T16:12:48Z")

</div>

Please check the first two quotation marks. It seems your browser inserts Unicode characters instead of simple quotation marks like `".."`

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [January 22, 2023, 4:18pm UTC](https://community.homey.app/t/app-pro-local-api/70840/24 "2023-01-22T16:18:56Z")

</div>

Brilliant - thanks that’s fixed it. I could have stared at that for days and not seen that!

---

<div class="post-metadata">

**Author:** ![homeypro](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/homeypro/32/51936_2.png) [@homeypro](https://community.homey.app/u/homeypro)\
**Post date:** [January 22, 2023, 6:58pm UTC](https://community.homey.app/t/app-pro-local-api/70840/25 "2023-01-22T18:58:37Z")

</div>

Hi @ilpaolino,  
Can you maybe make possible to recieve any post text or json data on the trigger card?

---

<div class="post-metadata">

**Author:** ![ilpaolino](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ilpaolino/32/49565_2.png) [@ilpaolino](https://community.homey.app/u/ilpaolino)\
**Post date:** [January 23, 2023, 6:48pm UTC](https://community.homey.app/t/app-pro-local-api/70840/26 "2023-01-23T18:48:04Z")

</div>

Hello,  
in the next updates I would like to find a way to introduce a control that alerts the user when in the settings page he selects a busy port (at the moment it is the only cause of crashes and malfunctions of the application)

As for reading a JSON passed via POST, I first need to understand how to dynamically generate attributes (at the moment this possibility is not documented in the docs).

---

<div class="post-metadata">

**Author:** ![homeypro](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/homeypro/32/51936_2.png) [@homeypro](https://community.homey.app/u/homeypro)\
**Post date:** [January 24, 2023, 11:24am UTC](https://community.homey.app/t/app-pro-local-api/70840/27 "2023-01-24T11:24:03Z")

</div>

Okay. And maybe a wildcard trigger and a tag with the endpoint that’s called? That would be awesome!

---

<div class="post-metadata">

**Author:** ![roelvdberge](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/roelvdberge/32/70663_2.png) [@roelvdberge](https://community.homey.app/u/roelvdberge)\
**Post date:** [February 20, 2023, 11:06am UTC](https://community.homey.app/t/app-pro-local-api/70840/28 "2023-02-20T11:06:38Z")

</div>

Hi Paolo,

First of all: thank you for creating this. I use LocalAPI to serve a JSON that I construct with HomeyScript. It gives my power usage per month in a JSON and I consume that in a custom module (forked from MMM-Chart) that displays a bar chart on my [MagicMirror²](https://magicmirror.builders/) to show a bar chart. It works but it seems there’s some sort of memory leak that causes the app to pause sometimes:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/e/3e22fa3a7eb137d97297c42176aeb249a37a52e8.png)

This is the flow that serves the JSON:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/e/8ec3afa668e76b8f80c6f5018899aaf892ea4910.png)

The call is done every 15 seconds, but I don’t understand why the memory consumption builds up. Any ideas or possible solutions?

Thanks again for your work!

Cheers, Roel

---

<div class="post-metadata">

**Author:** ![ilpaolino](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ilpaolino/32/49565_2.png) [@ilpaolino](https://community.homey.app/u/ilpaolino)\
**Post date:** [February 20, 2023, 12:34pm UTC](https://community.homey.app/t/app-pro-local-api/70840/29 "2023-02-20T12:34:52Z")

</div>

Hi Roel,  
theoretically every call call at the end of cycle the `destroy` method that free up the memory.

It seems that part isn’t executed, have you an example of your `usageChartJson`, so I can try to reproduce the problem locally?

Thank you

Paolo

---

<div class="post-metadata">

**Author:** ![roelvdberge](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/roelvdberge/32/70663_2.png) [@roelvdberge](https://community.homey.app/u/roelvdberge)\
**Post date:** [February 20, 2023, 12:39pm UTC](https://community.homey.app/t/app-pro-local-api/70840/30 "2023-02-20T12:39:55Z")

</div>

Sure: right now it’s this:

{“status”:“success”,“url”:“/energy/usage”,“method”:“GET”,“data”:[{“y”:“Nu”,“x”:2.028},{“y”:“Vandaag”,“x”:4.57},{“y”:“Februari”,“x”:41.68}]}

It’s a logic variable that gets updated everytime the energy usage changes.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 20, 2023, 2:44pm UTC](https://community.homey.app/t/app-pro-local-api/70840/31 "2023-02-20T14:44:11Z")

</div>

Perhaps interesting: [[APP][Pro] Sun Events (Update SDK3) - #131 by Sharkys](https://community.homey.app/t/app-pro-sun-events-update-sdk3/71043/131)

---

<div class="post-metadata">

**Author:** ![basvanderploeg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/basvanderploeg/32/83556_2.png) [@basvanderploeg](https://community.homey.app/u/basvanderploeg)\
**Post date:** [February 21, 2023, 2:32pm UTC](https://community.homey.app/t/app-pro-local-api/70840/32 "2023-02-21T14:32:52Z")

</div>

Unfortunately this doesn’t seems to work on the new Homey Pro 2023.

The only response I get is `{"status":"not-found"}`

Then I try to do exactly the same thing on my old Homey Pro, everything works fine.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [March 19, 2023, 1:26pm UTC](https://community.homey.app/t/app-pro-local-api/70840/33 "2023-03-19T13:26:02Z")

</div>

Hi @ilpaolino Thanks for the app which I use extensively with my dashboard. Recently I’m finding the app occasionally stops responding to requests until I restart it. I’ve sent a diagnostics report 5ec46390-fccb-4a4d-a185-a2a433dfcdc9

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [March 22, 2023, 12:49pm UTC](https://community.homey.app/t/app-pro-local-api/70840/34 "2023-03-22T12:49:15Z")

</div>

I’ve been seeing lots of instability on my Homey recently with apps freezing and so on. Main thing I’ve changed recently is updating my dashboard to send requests more frequently to the Local API app running on my Homey Pro 2019. I had a requests polling every 10s and returning a JSON structure with various data for the home page of my dashboard. This morning I re-designed the dashboard so that it now makes the exact same API call with the exact same response but every 60s instead of every 10s. I restarted the Local API app when I deployed the new dashboard design - at about 0800. See the memory chart for Local API app below which clearly builds up more and more memory use over time and was doing so much more quickly with the faster refresh rate and much more slowly (but still as steadily) now.

 ![Screenshot 2023-03-22 at 12.45.07](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/6/c6111bbbaf56703276f9c51890bcea10c0e10faf.png)

---

<div class="post-metadata">

**Author:** ![ilpaolino](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ilpaolino/32/49565_2.png) [@ilpaolino](https://community.homey.app/u/ilpaolino)\
**Post date:** [March 23, 2023, 9:45pm UTC](https://community.homey.app/t/app-pro-local-api/70840/35 "2023-03-23T21:45:55Z")

</div>

Ok, I tried to solve the error by emptying and deleting how much I could at the end of the request.

Can you try and tell me if the new version that I have just published suffers from the same bug?

---

<div class="post-metadata">

**Author:** ![Teddy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/teddy/32/13818_2.png) [@Teddy](https://community.homey.app/u/Teddy)\
**Post date:** [March 24, 2023, 6:32am UTC](https://community.homey.app/t/app-pro-local-api/70840/36 "2023-03-24T06:32:40Z")

</div>

This is happening to me also with not found as return status.

---

<div class="post-metadata">

**Author:** ![ilpaolino](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ilpaolino/32/49565_2.png) [@ilpaolino](https://community.homey.app/u/ilpaolino)\
**Post date:** [March 24, 2023, 6:46am UTC](https://community.homey.app/t/app-pro-local-api/70840/37 "2023-03-24T06:46:07Z")

</div>

Have you try the new version (1.1.3) released 9 hours ago?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [March 24, 2023, 7:38am UTC](https://community.homey.app/t/app-pro-local-api/70840/38 "2023-03-24T07:38:36Z")

</div>

Updated to the latest version last night. It’s early to tell whether the memory issue is fixed - it looks promising, though memory usage has started going up substantially this morning as I’ve been making more requests via the dashboard (though still not a large number). Will report back on that. But there’s a new problem: now requests are taking a very long time to get a response. Like, 20 or 30 seconds for requests which yesterday got responses almost instantly. Some are timing out entirely.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [March 24, 2023, 7:39am UTC](https://community.homey.app/t/app-pro-local-api/70840/39 "2023-03-24T07:39:47Z")

</div>

Hmm, maybe the memory issue not looking that great. This is over the last hour. And I’ve had one request waiting for minutes now

 ![Screenshot 2023-03-24 at 07.38.55](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/4/d4b3a545e547fbea88a9e69be7e2ebe4d00493d3.png)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Draper](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jonathan_draper/32/33978_2.png) [@Jonathan\_Draper](https://community.homey.app/u/Jonathan_Draper)\
**Post date:** [March 24, 2023, 8:06am UTC](https://community.homey.app/t/app-pro-local-api/70840/40 "2023-03-24T08:06:15Z")

</div>

@ilpaolino Would it be possible please to revert to the previous published version since that was working albeit with memory leak whereas this version completely breaks my dashboard. I would be very happy to help testing with experimental versions if that is useful to get this fixed without breaking everyone’s integrations using the app.

[Previous page](https://community.homey.app/t/app-pro-local-api/70840.md?page=1)

[Next page](https://community.homey.app/t/app-pro-local-api/70840.md?page=3)
