Advanced Flow and HomeyScript

I have created a Homey Script which returns the number of TV Programs found.

I want to use that script in an advanced flow, but there’s no card for “Execute Script with an Argument and Return a Number”.

There’s only “Execute Code with an Argument and Return a Number”, but I don’t want to use that, because my script can be called by a lot of flows (and if I need to change something, I only need to change one script, not all the “execute code” in all my flows).

So…what to do?


Here you can call a script by his name.

Yes, but I need a return type (number, string or boolean). I want to have a tag which I can use for the next part in my flow.

Now I need to save the outcome of my script to a variable (a Homey Script variable, a Logic variable or a BLL variable).

What is wrong with the additional tag you can use in the flow? Just connect the HomeyScript card to the card you want to use value in, and select the local tag “result” in there.

Maybe I am missing something?

Which “result”? There’s no local tag “result”, because there’s now flow card which calls a SCRIPT which returns a local tag.

Only the cards which uses CODE have a return tag. As I have written before, my SCRIPT can be called from a lot of places, I don’t want to copy-paste my SCRIPT into a CODE section of HomeyScript.

Aaah, then I read it wrong my bad.
Indeed, HomeyScript’s Script, is a separate part of the app, the flow can only run the script, that is how it was designed as Advanced Flows didn’t exist back then, changing that would most likely break all those existing codes of people already running scripts.

The code part of the app was added when Advanced flows was introduced for this very reason, so the only option you have is to run it in the Code card, or indeed save it to a logic variable.

1 Like

You can create a (global?) tag inside HomeyScript:

await tag("tagName", variable);

This tag you can use in the following AdvancedFlow card.