Built-in flow stack variable

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Built-in flow stack variable

Post by canadaDry » 29 Nov 2018 07:09

My main automagic use is to handle home/personal automation tasks like acting on voice commands, speaking aloud reminders/info, turning on/off things, and accessing the net for news/weather/misc info.

To achieve this I use a couple dozen flows (along with a python backend server). Most of the flows call other flows. Sometimes 3+ levels deep.

To handle error conditions (e.g. a target device isn't responding to a http get command) I have a generic "Ooops, an error occurred" flow that says (aloud) what flow caused the error. The Ooops flow gets called from the flow where the error occurred. To know which flow this was, I set a global variable (e.g. global_prev_flow) in every flow where I might end up calling the Ooops flow.

Having to set the global variable in each flow works, but it's a bit tedious and I wonder if I've missed a more obvious/elegant way to do this?

Also... I wonder whether there's already an internal flow stack/list that could be exposed as a builtin variable (hi Martin) which could be more readily available for use?

I just noticed there's a previous topic (viewtopic.php?f=4&t=3793) that seems to be onto the same thing.

User avatar
beelze
Posts: 46
Joined: 04 Nov 2018 16:45

Re: Built-in flow stack variable

Post by beelze » 29 Nov 2018 12:19

+1 for calling stack.

BTW, what is the python backend server?

User avatar
Helios
Posts: 17
Joined: 22 Oct 2018 09:41

Re: Built-in flow stack variable

Post by Helios » 29 Nov 2018 14:43

Hi,

you do not necessarily need to use a global var (global_prev_flow).
Simply use prev_flow (non global var).

https://automagic4android.com/en/help/c ... cute_flows
The executed flow will inherit the execution context with all variables of the parent flow.
Although this is not your main issue, maybe it helps.

canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Re: Built-in flow stack variable

Post by canadaDry » 29 Nov 2018 15:12

beelze wrote:what is the python backend server?
I use cherrypy.org. It's basic but is lightweight, very reliable and handles JSON.
Helios wrote:you do not necessarily need to use a global var (global_prev_flow). Simply use prev_flow (non global var).
Yes, I could. I recall having an absolutely brilliant reason for using global when I first designed the system - tho it escapes me now! :)

Locked