# How to call flows by name in an action card with a logic variable via homeyscript

**URL:** <https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449>\
**Category:** Questions & Help\
**Tags:** tools, flow\
**Created:** [June 15, 2021, 12:27pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449 "2021-06-15T12:27:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [June 15, 2021, 12:27pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/1 "2021-06-15T12:27:34Z")

</div>

I tried to start a flow (Flowstart) with its name in homeyscript and got the following error:

Homey.flow.runFlowCardAction({  
uri: ‘homey:manager:flow’,  
id: ‘programmatic\_trigger’,  
args: {  
name: ‘Flowstart’,  
type: ‘autocomplete’,  
},  
});

Script Error  
⚠ Cannot read property ‘id’ of undefined: Cannot read property ‘id’ of undefined  
at /node\_modules/athom-api/dist/index.js:1:1186403  
at processTicksAndRejections (internal/process/task\_queues.js:97:5)

I tried to find a solution in this forum and documentation, but I am a little bit lost.

Is it even possible to do it this way?  
What did I wrong?

THX

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [June 15, 2021, 3:00pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/2 "2021-06-15T15:00:50Z")

</div>

> [@Joka](#):
>
> Homey.flow.runFlowCardAction

Can you give me a hint where you found this command? In AppAPI documentation?

I just found this:

> **[ManagerFlow - Homey Apps SDK v3](https://apps-sdk-v3.developer.homey.app/ManagerFlow.html)**

If I’m right, you get he flowcard with Homey.flow.getTriggerCard(id) and call method trigger() to trigger the flow.

> **[FlowCardTrigger - Homey Apps SDK v3](https://apps-sdk-v3.developer.homey.app/FlowCardTrigger.html)**

I didn’t test it, so it’s just my thought about the Api…perhaps it’s gettimg you on the right way.

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [June 15, 2021, 3:21pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/3 "2021-06-15T15:21:43Z")

</div>

Hi Ronny,

1. I start with the examples, on github (same as homey-\>webapp-\>homeyscript):  
[com.athom.homeyscript/flowcard-run.js at master · athombv/com.athom.homeyscript · GitHub](https://github.com/athombv/com.athom.homeyscript/blob/master/examples/flowcard-run.js)

```auto
// Run 'Show Animation' Flow 'Then' Card
// This will pulse Green (#00FF00) when it's a weekend
// or pulse Red (#FF0000) when it's a weekday
await Homey.flow.runFlowCardAction({
  uri: 'homey:manager:ledring',
  id: 'show_animation',
  args: {
    animation: 'pulse',
    color: isWeekend
      ? '#00FF00'
      : '#FF0000',
  },
});

```

1. with the following example it’s possible to show all options for and+then cards of the homey environment:  
[com.athom.homeyscript/flowcard-list.js at master · athombv/com.athom.homeyscript · GitHub](https://github.com/athombv/com.athom.homeyscript/blob/master/examples/flowcard-list.js)

there I found:

```auto
Start [Flow start]
{
  "uri": "homey:manager:flow",
  "id": "programmatic_trigger",
  "args": [
    {
      "name": "flow",
      "type": "autocomplete"
    }
  ]
}

```

1. My adaption of both examples was:

```auto
await Homey.flow.runFlowCardAction({
  uri: 'homey:manager:flow',
  id: 'programmatic_trigger',
  args: {
          name: 'Flowstart',
          type: 'autocomplete',
  },
});

```

But I think because the flow execution card is from type “autocomplete” (a catalog of all flows) it doesen’t work. Maybe the api doesn’t provide it.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 15, 2021, 3:49pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/4 "2021-06-15T15:49:04Z")

</div>

```auto
await Homey.flow.runFlowCardAction({
  uri: 'homey:manager:flow',
  id: 'programmatic_trigger',
  args: { flow: { id : ID_OF_FLOW_TO_RUN } }
});

```

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [June 15, 2021, 4:27pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/5 "2021-06-15T16:27:45Z")

</div>

Indeed @robertklep this works very well:

```auto
await Homey.flow.runFlowCardAction({

  uri: 'homey:manager:flow',
  id: 'programmatic_trigger',

  args: { flow: { id : 'd86acee8-59b1-4fdf-948f-xxxx'} }

});

```

Thank you very much! Could you provide us with the information were you find this in the documentation, please.

And for the others who are not so familiar with homeyscript like me. You can find out the ID of the flows with:

`Homey.flow.getFlows();`

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 15, 2021, 6:34pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/6 "2021-06-15T18:34:09Z")

</div>

> [@Joka](#):
>
> Could you provide us with the information were you find this in the documentation, please.

I didn’t, I used reasoning to find out how it’s supposed to be called:

- the declaration of the action states that is has an argument named `flow` of type `autocomplete`
- if you know the “Start a flow” card from the flow editor, you know that you have to pick a flow to start with an autocomplete form
- I assumed that it would store the “flow object”, or at least the unique identifier for a flow (`id`), to be able to start the flow
- hence, I tried calling the action card using an argument called `flow` with an object that contains (at least) `id`, which worked

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [June 15, 2021, 7:12pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/7 "2021-06-15T19:12:05Z")

</div>

Ok, it’s your experience, thx for your description, I learnt a lot.

And reached my goal to call flows by name in an action card with a logic variable via homeyscript:

```auto
/*
 * This script starts a flow by Flow Name with a logic variable in a 'Then' Flow Card.
 * This script overcomes the disadvantage of the manual Flow Start Card,
 * which currently (6-17-2021) does not allow you to use tags to start other flows.
 */

// homeyscript action card argument -> flow name
const flow_name = (typeof args[0] === 'string')
  ? args[0]
  : 'dummy';

// filter flow object by flow name
const flow_obj = await Homey.flow.getFlows({ filter: {name: flow_name}});

// fetch flow id from flow object
const flow_id = Object.keys(flow_obj)[0];

// start flow
if (flow_id){
  await Homey.flow.runFlowCardAction({
    uri: 'homey:manager:flow',
    id: 'programmatic_trigger',
    args: { flow: { id: flow_id } }
  });
}

```

Edit: improved code a little bit

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/4/f4bda2baa8e2e04a238e7e1266adff0a40d52e57.png)

flow-start = homeyscript name  
BW\* = logic text variable with flow name

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [June 16, 2021, 12:15pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/8 "2021-06-16T12:15:11Z")

</div>

Very interesting. So, from what I understand your goal is:  
you can start flow X from flow A, while the name of flow X depends on the value of a variable?

---

<div class="post-metadata">

**Author:** ![Joka](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joka](https://community.homey.app/u/Joka)\
**Post date:** [June 16, 2021, 12:50pm UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/9 "2021-06-16T12:50:32Z")

</div>

Exactly, that’s the charm vs. the manual configuration of a flow start because in this case you can’t use tags.

Reduces the flow amount immense. My use case is an irrigation system with a lot of cascading flows which are **reused** for each of 12 cycles.

So with this configuration the finish of a timer flow starts other flows dynamically. Which means I need only this **one** timer flow and not 12 of them which start distinct other flows.

---

<div class="post-metadata">

**Author:** ![Sre](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sre/32/73560_2.png) [@Sre](https://community.homey.app/u/Sre)\
**Post date:** [January 30, 2026, 10:18am UTC](https://community.homey.app/t/how-to-call-flows-by-name-in-an-action-card-with-a-logic-variable-via-homeyscript/48449/10 "2026-01-30T10:18:06Z")

</div>

I came here to help future users if they want to run a advanced flow from a homey script, this can be done like so

```auto
const searchFlowName = 'some advanced flow name';

const foundFlows = Object.values(await Homey.flow.getAdvancedFlows()).filter((flow) => flow.name === searchFlowName);
if (foundFlows.length > 0) {
  await Homey.flow.runFlowCardAction({
    uri: 'homey:manager:flow',
    id: 'homey:manager:flow:programmatic_trigger',
    args: {
      flow: {
        id: foundFlows[0].id,
        name: foundFlows[0].name,
        type: 'advanced'
      }
    }
  });
} else {
  throw "unknown flow"
}

```
