# HomeyScript runFlowCardAction for Home Assitant

**URL:** <https://community.homey.app/t/homeyscript-runflowcardaction-for-home-assitant/138051>\
**Category:** Questions & Help\
**Tags:** app, flow, homey-pro\
**Created:** [June 12, 2025, 2:47pm UTC](https://community.homey.app/t/homeyscript-runflowcardaction-for-home-assitant/138051 "2025-06-12T14:47:44Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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 12, 2025, 10:58pm UTC](https://community.homey.app/t/homeyscript-runflowcardaction-for-home-assitant/138051/5 "2025-06-12T22:58:51Z")

</div>

> [@Kurt1](#):
>
> When I run
> 
> ```auto
> log('===========');
> log('Then-cards:');
> log('===========');
> const actionCards = await ......
> 
> ```

Unfortunately this only works in ‘classic’ homeyscript.  
Things have changed since HS uses homey-api instead of athom-api for new scripts [(source)](https://community.homey.app/t/homeyscript-looking-for-testers/109249)

`uri` and `id `are now combined as `id`:

 ![Screenshot_20250613_003201_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/c/bc3ed650230eac236230c6577705596457b5e32c.jpeg)  
([source of screenshot](https://athombv.github.io/com.athom.homeyscript/tutorial-migrate))

Second, I always first create the service (called ‘action’ nowadays) in the ‘Actions’ tab of HA Developer tools, to make sure it works:

 ![Screenshot_20250612_221659_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/862082a537d07c948a7fc83c4c3dd5f4bfdae6ce.jpeg)

Next, I check if this works with a real flow card:

 ![Screenshot_20250612_222734_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/d/bd4696fdaf0c5bea4d1d0850a5e961b4b3be6279.jpeg)

So far, so good.  
However, I can’t get the script to run successfully

This one errrors:

```auto
const test = await Homey.flow.runFlowCardAction({
    id: 'homey:app:io.home-assistant.community:callServiceEntity',
    args: {
      service: 'tts.google_translate_say',
      entity: 'media_player.yamaha_kamer',
      data: {
        'message':'hallo dit is homey',
        'language':'nl'
        }
    },
});

console.log(test);

```

Error:

```auto
{
  returnTokens: null,
  usedTokens: {},
  error: { message: 'Unexpected token o in JSON at position 1' },
 }

```

The issue seems to be the data part. The [JSON should be converted to a string](https://stackoverflow.com/questions/38380462/syntaxerror-unexpected-token-o-in-json-at-position-1#38380728)

So I tried `toString`, and the `JSON.stringify` Arnt used, but it’s not working yet;  
This one errors as well:

```auto
const test = await Homey.flow.runFlowCardAction({
    id: 'homey:app:io.home-assistant.community:callServiceEntity',
    args: {
      service: 'tts.google_translate_say',
      entity: 'media_player.yamaha_kamer',
      data: JSON.stringify({
        'message': 'hallo dit is homey',
        'language': 'nl'})
    },
});

console.log(test);

```

Error:

```auto
{
  returnTokens: null,
  usedTokens: {},
  error: { message: "Cannot read properties of undefined (reading 'split')" },
}

```

I’m no coder or expert in this, I think I’m close but no cigar apparently 🤣.  
I’m out of ideas here.

This works fine however:

```auto
const test = Homey.flow.runFlowCardAction({
  id: 'homey:manager:mobile:push_text',
    args: {
        user: {
        id: 'xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxx',
	    athomId: 'xxxxxxxxxxxxxxx',
	    },
	    text: 'Test push notification from HomeyScript'
        },
     });
console.log(test);

```

 ![Screenshot_20250613_011920_One UI Home](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/a/3a728aa9871b7e62e999a9cf385512e07a60d0d6.jpeg)

---

_[View the full topic](https://community.homey.app/t/homeyscript-runflowcardaction-for-home-assitant/138051)._
