[App][Pro] Local API

New version in test: 1.1.2
Can you try again?

Thank you

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:

I get this response:

{
  "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!

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

1 Like

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

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

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).

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

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² to show a bar chart. It works but it seems there’s some sort of memory leak that causes the app to pause sometimes:

This is the flow that serves the JSON:

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

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

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.

Perhaps interesting: [APP][Pro] Sun Events (Update SDK3) - #131 by Sharkys

2 Likes

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.

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

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.

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?

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

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

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.

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

@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.