[APP][Pro] Better Logic Library - Just some better logic, variable and library management

Indeed, the Watch card uses the homey-api.

Almost everything about the homey-api is heavy on cpu/memory. There are some situationeel that the Watch card is the only available option, but if not, beter use alternative if possible.

BLL coding is done in a Javascript Sandbox (stand-alone engine running the code). So using 6 flowcards to calculate will indeed use more resources than using one flowcard (be it a BLL or HomeyScript flowcard).

BLL coding/expressions uses the same methods as HomeyScript, so singular use would use about the same resources. BLL does add some functions and replaces some possible values (like the checkmark we get instead of true since hp23), so it might use a little bit more cpu when starting the script, but thats real small/low.

@Arie_J_Godschalk, I also thought that BLL used JavaScript quite efficiently. But the difference between the old en new flow is quite large, is this only because of the reduction from 6 to 3 cards (and maybe use of global variable vs BLL variable). I tried 1 single scriptcard, but that became less clean with merging and splitting values. Moreover, no less CPU load (or even more load when getting capabilities inside the script, in stead of as argument from the flow)

const parts = args[0].split(';');
const faseVarName = parts[0];
const newValue = parseFloat(parts[1]);

let values = JSON.parse(global.get(faseVarName) || '[0,0,0,0,0]');
values.shift();
values.push(Math.abs(newValue));
global.set(faseVarName, JSON.stringify(values));

const result = _.round(_.mean(_.sortBy(values).slice(0, -1)), 2);

return result;

With CPU usage before and after:

Hi Arie,

I’m having an issue with the Better Logic Library file server on my Homey Pro.

I use the BLL file server to make an AVI file available for download. BLL successfully generates both a local URL and a CloudUrl for the file.

The strange part is:

  • The correct AVI file is found and the generated URLs contain the correct filename.
  • An internal HTTP test has previously returned HTTP 200 and the response started with RIFF…AVI, so the AVI file itself was definitely accessible.
  • Opening the generated CloudUrl externally results in “Cannot GET /app/net.i-dev.betterlogic/userdata/getfile/…”.
  • In another test the internal HTTP request timed out after 10000 ms.
  • File server Auto Start is enabled.
  • Auto Shutdown is disabled.
  • Availability is currently set to 60 seconds.

I generated a diagnostic report immediately after reproducing the problem.

Diagnostic report ID:
f58f8dd8-61a2-4d40-9aa1-773336f566bb

Could you please have a look at the diagnostic report and let me know whether there is something wrong with the generated download route or the BLL file server?

Thanks!

This means that the file does not exist. Are you sure that you’ve entered the filename correctly?

I’m also not sure if “getfile” is needed, have you tried without that?

Thanks. I tested this with a newly generated file: MDalarm_20260823_192229.avi.

I’m sure the filename is correct. Using the URL generated by BLL internally returns HTTP 200, and the response starts with RIFF, so the AVI file exists and can actually be read.

I also tested your suggestion and removed /getfile/ from exactly the same URL. In Safari that request just keeps loading and returns nothing.

So with /getfile/ the BLL-generated URL works internally (HTTP 200 + RIFF), but opening it externally results in “Cannot GET”. Without /getfile/, the request hangs.

Diagnostic report ID: f58f8dd8-61a2-4d40-9aa1-773336f566bb

Can you share the full URL? So the internal local URL, not the cloud URL (since the cloud URL contains a sensitive unique identidier)

Sure. This is the full internal/local URL generated by BLL:

https://192-168-178-216.homey.homeylocal.com/app/net.i-dev.betterlogic/userdata/getfile/83ad6434c8227defb26d0580a8b379f3f952e69186ff7114/MDalarm_20260823_192229.avi

This is exactly as returned by the BLL flow card; I did not construct or modify the URL manually.

Thanks.

Okay, an have you tried looking up your Cloud ID in More->Settings->System and using this URL: https://cloudid.connect.athom.com/app/net.i-dev.betterlogic/userdata/getfile/83ad6434c8227defb26d0580a8b379f3f952e69186ff7114/MDalarm_20260823_192229.avi, where you replace cloudid with your actual Cloud ID? So the exact same URL. If that doesn’t work, you should contact Athom as app developers have no control over how the cloud relay handles userdata.

Thanks. I checked the Cloud ID directly in More → Settings → System and tested the URL exactly as you suggested.

Unfortunately, the result is still:

Cannot GET /app/net.i-dev.betterlogic/userdata/getfile/...

So it looks like this may indeed be related to the Athom cloud relay handling of userdata, as you suggested.

Thanks for helping me verify this.

The Athom relay does work with userdata, at least in my own apps (I’m using a Pro 2019). Maybe Athom blocked specific filetypes to prevent abuse (e.g. to prevent people abusing their cloud relay for watching hours-long movies remotely which it’s obviously not intended for). Have you tried another file extension?

@Arie_J_Godschalk

hi arie

Since a few weeks it often happens the app is stuck or not Loading my variables ( often after a reboot ).

This morning again

251897cb-8c12-40ff-9c19-03ccc404a505

Hope u can resolve

Maybe add some context? What specific action lead to a freeze, how many BLL variables do you have, what do you mean by ‘loading my variables’, etc.

I told the action … a homey reboot … the app crashes

I told what happened … my vars are not loading ( screen below stays blanco )

I just have 3 vars .. they show up after i restart the app manually again

Could it be that the BLL app has not finished loading yet?

Except for not being able to access the app settings page, do the BLL variables themselves work?

No like i told above it crashed … flows that use the variables do not work anymore.

I will wait fir the app dev .. since my report was made during the crash.

@Arie_J_Godschalk

Hi Arie

Same thing happening also had the below

Where did you get this error?

@Arie_J_Godschalk

When i open your app settings … after a timout

i have removed your app and switched all the vars to homey vars unfortunately

It messes up to much depending flows for weeks now and had no response on my earlier question…. So i can not test anymore. Also it seams i am the onlyone somehow :person_shrugging:

Which homey were you running it on?

Sorry about my late response, I had vacation and am still getting back om my feet.

@Arie_J_Godschalk

No problem i understand.

Its a homey pro 2023 ( did sent you a error report a fee post above this one when it was in its “crashed” state )