# Beginner needs a quick tip

**URL:** <https://community.homey.app/t/beginner-needs-a-quick-tip/86533>\
**Category:** Developers\
**Created:** [August 8, 2023, 2:14pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533 "2023-08-08T14:14:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 8, 2023, 2:14pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/1 "2023-08-08T14:14:20Z")

</div>

Hello together

I am currently trying my hand at developing my first app, settings etc are already working…

But what I can not manage, that the flow card runs. I always get the following error message:

Flow Card not registered (type: action, id: disable-piholes)

What do I have to do in app.js to make this work? I am on the hose right now …

If someone has a good example so that I can understand this, I would be grateful.

---

<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:** [August 8, 2023, 2:19pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/2 "2023-08-08T14:19:55Z")

</div>

Please share your code.

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 8, 2023, 5:44pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/3 "2023-08-08T17:44:46Z")

</div>

Thanks for your reply, happy to share what I already have, it’s not much since I’m learning 😉

So:  
There is the whole repository, an action flow called:

disable-piholes.json  
{  
“title”: {  
“en”: “Disable PiHole(s)”  
},  
“hint”: {  
“en”: “Disable PiHole”  
},  
“args”: [  
{  
{ “type”: “number”,  
}, “name”: “time”,  
“placeholder”: {  
“en”: “0”  
},  
“min”: 0,  
“max”: 60,  
“step”: 5  
}  
]  
}

Then I found out via the docs and a few examples that it should now probably continue in App.js:

const Homey = require(‘homey’);

class App extends Homey.App {  
async onInit() {

```
//Write to the log
this.log('MyApp has been initialized');

//Supply the necessary information
const instance1_url = this.homey.settings.get('Instance1_URL');
const instance1_port = this.homey.settings.get('Instance1_PORT');
const instance1_api = this.homey.settings.get('Instance1_API');

const instance2_url = this.homey.settings.get('Instance2_URL');
const instance2_port = this.homey.settings.get('Instance2_PORT');
const instance2_api = this.homey.settings.get('Instance2_API');

```

…

That’s where I’m at now.

Now comes the question, how do I get rid of the error mentioned at the beginning, obviously I need a listener which listens if something happens but its implementation is not clear to me even after reading. I have tried many things and derived, but it has always remained with the error.

Therefore my request for a little push in the right direction 🙂

Thank you very much.

---

<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:** [August 8, 2023, 5:50pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/4 "2023-08-08T17:50:03Z")

</div>

> [@TroRon](#):
>
> obviously I need a listener

[“For every Flow card your app includes, you should register a “run” listener”](https://apps.developer.homey.app/the-basics/flow#listening-for-events):

```auto
this.homey.flow.getActionCard('disable-piholes').registerRunListener(async (args, state) => {
  console.log('A', args, 'S', state);
});

```

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 8, 2023, 6:05pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/5 "2023-08-08T18:05:48Z")

</div>

Ok, that coincides with what I found, and shows me that I am at least on the right track.

Nevertheless the error remains … and that’s what I don’t understand, or not yet 😉

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/e/5ea08c507d82fa3f1df3bdb6f5fb4c5f9264c2ea.png)

---

<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:** [August 8, 2023, 6:11pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/6 "2023-08-08T18:11:36Z")

</div>

That code fixes the issue, if the error remains it’s either placed in the wrong location or you didn’t restart the app. I assume you’re also not getting the console log message?

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 8, 2023, 6:13pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/7 "2023-08-08T18:13:49Z")

</div>

Hmmmm …  
Then it is probably in the wrong place …

I have restarted the app. Console messages I also do not see, resp. I would not know where ☹

But if I know that the code works I like to read in further 🙂

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 8, 2023, 7:52pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/8 "2023-08-08T19:52:58Z")

</div>

So actually I am of the opinion it should be correct, but it still does not go …

What am I missing?

```auto
const Homey = require('homey');

class App extends Homey.App {
  async onInit() {

    //Write to the log
    this.log('MyApp has been initialized');

    //Supply the necessary information
    const instance1_url = this.homey.settings.get('Instance1_URL');
    const instance1_port = this.homey.settings.get('Instance1_PORT');
    const instance1_api = this.homey.settings.get('Instance1_API');
    
    const instance2_url = this.homey.settings.get('Instance2_URL');
    const instance2_port = this.homey.settings.get('Instance2_PORT');
    const instance2_api = this.homey.settings.get('Instance2_API');

    //Define the listeners for each necessary FlowCard  
    
    //disable-piholes.json
    this.homey.flow.getActionCard('disable-piholes').registerRunListener(async (args, state) => {
      console.log('A', args, 'S', state);
    });  

    //enable-piholes.json
    this.homey.flow.getActionCard('enable-piholes').registerRunListener(async (args, state) => {
      console.log('A', args, 'S', state);
    });  

  }
}
module.exports = App;

```

---

<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:** [August 9, 2023, 5:49am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/9 "2023-08-09T05:49:05Z")

</div>

I don’t know what you’re doing wrong (apart from not using the `</>` button to format your code 😉 ) , this works just fine for me.

Where are the JSON files located? They should be in `.homeycompose/flow/actions/`

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 9, 2023, 6:09am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/10 "2023-08-09T06:09:03Z")

</div>

Thanks for your reply again and your time 🙂

Also thanks for the input of the code formatting 🙂

Yes, they are actually really in the right place…

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/86f0a69dbd9f78dcfa8021cbb9d61203a3a79fe9.png)

---

<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:** [August 9, 2023, 7:31am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/11 "2023-08-09T07:31:43Z")

</div>

Would it be possible to put your app online somewhere, like Github? The forum isn’t really a great medium to debug these issues.

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 9, 2023, 8:27am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/12 "2023-08-09T08:27:12Z")

</div>

Answered via DM

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 9, 2023, 9:07am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/13 "2023-08-09T09:07:04Z")

</div>

Tada…

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0ab97adb2a7696060136247bf4274f4164881d3f.png)

Thank you so much for your help, Robert

---

<div class="post-metadata">

**Author:** ![Valentin\_Ciopei](https://avatars.discourse-cdn.com/v4/letter/v/6bbea6/32.png) [@Valentin\_Ciopei](https://community.homey.app/u/Valentin_Ciopei)\
**Post date:** [August 9, 2023, 9:16am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/14 "2023-08-09T09:16:33Z")

</div>

Will you make this available in the store?

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 9, 2023, 9:25am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/15 "2023-08-09T09:25:50Z")

</div>

When I get the rest of the functionality, eventually, running, I’ll consider it, yes.

Currently it’s missing something like that and for me it’s my training project to deal with homey app development.

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 10, 2023, 1:56pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/16 "2023-08-10T13:56:17Z")

</div>

Brief Update:  
The app is finished so far and is waiting for approval …

I’m curious whether this works 😉

---

<div class="post-metadata">

**Author:** ![TroRon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/troron/32/81384_2.png) [@TroRon](https://community.homey.app/u/TroRon)\
**Post date:** [August 14, 2023, 9:01pm UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/17 "2023-08-14T21:01:13Z")

</div>

The app is now available 🙂

As a result of further development, I am now facing a new problem.

I am currently dealing with the tokens …

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/e/2e91081977d159b13356dff35fd1535d92fa3ad1.png)

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/7/879b1d567962e70472a2e5d3c04fb6fe2cf7df6d.png)

According to SDK the tokens are also defined in app.js, no matter if local or global I have the same error.

If I take the example and the token configuration from the SDK documentation I have the same error.

Does anyone else have an idea?

---

<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:** [August 15, 2023, 4:14am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/18 "2023-08-15T04:14:59Z")

</div>

Hi,  
I think you mixed up flow arguments with tokens.

Flow arguments are the input elements in your flow card where the user inserts values you are using in your flow handler.  
Flow tokens are returning parametersm the flow card passes back to the flow and you can use in following cards.

Please check if your flow handler is returning the defined tokens.  
If you don’t need result tokens, you can remove them from your flow definition.  
In general: The flow handler can return tokens (if defined) and in case of an error just throw an error. This will trigger the error output of your flow card (like your screenshot is showing).

Example: Flow definition:  
[https://github.com/RonnyWinkler/homey.mysql/blob/main/.homeycompose/flow/actions/post\_query.json](https://github.com/RonnyWinkler/homey.mysql/blob/main/app.js#L159)

Example flow handler:  
[https://github.com/RonnyWinkler/homey.mysql/blob/main/app.js#L21](https://github.com/RonnyWinkler/homey.mysql/blob/main/app.js#L21)  
And the tokens that are returned:  
[https://github.com/RonnyWinkler/homey.mysql/blob/main/app.js#L159](https://github.com/RonnyWinkler/homey.mysql/blob/main/app.js#L159)

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [August 15, 2023, 10:44am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/19 "2023-08-15T10:44:18Z")

</div>

Your “example” object is missing its end curly bracket.

---

<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:** [August 15, 2023, 10:48am UTC](https://community.homey.app/t/beginner-needs-a-quick-tip/86533/20 "2023-08-15T10:48:14Z")

</div>

If it did the app wouldn’t even build.

[Next page](https://community.homey.app/t/beginner-needs-a-quick-tip/86533.md?page=2)
