Any trick to get "local" variables for a flow?

Hello,

As far as I got it properly, variables that are defined in flows are global (shared among all flows)
image

I tried to find information on this forum to create “local variables” for my flows, I.e.: variables which would not be shared across flows, but would be local to the flow where it has been created (but not “temporary variables” ! I want them to be permanent even across reboots).

Did I miss something or I can only do it with a HomeyScript that create a Flow Tag ? If not mistaking, Flow Tags are assumed to be local to their flow… (hence their name :slight_smile: ).

I am asking because I tried with the script here under, called from a card HomeScript, and I see that the tag created is visible in all my flows :frowning:

if (args[0] === '' || args[0] === undefined)
  throw new Error('you have to pass your variable name and its value. Ex.: myvar, 1000');

const args_element = args[0].split(',');

if (args_element.length == 2){
  const name = args_element[0];
  const value = args_element[1];

  if (value === 'null')
    await tag(name, null); // Delete
  else
    await tag(name, value); // Create
} 
else if (args_element.length == 1) {
  const name = args_element[0];
  await tag(name, null); // Delete
}
else
  throw new Error('you have to pass your variable name and its value. Ex.: myvar, 1000');

return true

The purpose is to have the local variables created dynamically by any advanced flow instantiated from a “template”… (I.e.: I am more curious if it’s doable than stuck because I can’t do it)

Thx for any comment or advice.

V.

Nope, there is no way to achieve what you want.
You cannot create scoped variables that are boot-persistent.

Thx for the feedback !

V.