# Finding a specific flow that causes a ghost trigger

**URL:** <https://community.homey.app/t/finding-a-specific-flow-that-causes-a-ghost-trigger/163071>\
**Category:** Automation\
**Created:** [December 4, 2026, 11:37am UTC](https://community.homey.app/t/finding-a-specific-flow-that-causes-a-ghost-trigger/163071 "2026-12-04T11:37:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theuns\_vanNiekerk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theuns_vanniekerk/32/79069_2.png) [@Theuns\_vanNiekerk](https://community.homey.app/u/Theuns_vanNiekerk)\
**Post date:** [December 4, 2026, 11:37am UTC](https://community.homey.app/t/finding-a-specific-flow-that-causes-a-ghost-trigger/163071/1 "2026-12-04T11:37:01Z")

</div>

Yesterday I started getting message notifications that a specific device is not responding. I looked through all the advanced flows I could think of to find the ghost message, to no avail. AI wrote me a short script to search all the flows for a specific phrase, and I found the culprit message source in a second or less.

I thought I would share the script here if someone needs a similar function.

Copy the script below and paste it into a Homey Script “‘Run my code’ with ‘MyArg’ and return Text-tag’”  
Input Argument: Create a text tag with a simple json containing the search phrase, pass the text tag as the “argument”.  
Add a Text-tag to receive the output of the script

Execute the flow and read the results in the text-tag.

It saved me hours of searching.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/6/96a4d41fc51d35365348f6cd2a76af4f81333456.png)

# SCRIPT

// Search flows for phrase

let settings;

try {  
settings = JSON.parse(args[0]);  
} catch (e) {  
return JSON.stringify({  
error: “Invalid JSON argument”  
});  
}

const searchText = String(settings.search || “”).toLowerCase();

if (!searchText) {  
return JSON.stringify({  
error: “No search string supplied”  
});  
}

const result = {  
search: settings.search,  
matches: 0,  
flows:   
};

// ---------- Regular Flows ----------

const flows = await Homey.flow.getFlows();

for (const flowId in flows) {  
const flow = flows[flowId];

```auto
const flowJson = JSON.stringify(flow).toLowerCase();

if (flowJson.includes(searchText)) {
    result.flows.push({
        type: "flow",
        name: flow.name,
        id: flow.id
    });
}

```

}

// ---------- Advanced Flows ----------

const advancedFlows = await Homey.flow.getAdvancedFlows();

for (const flowId in advancedFlows) {  
const flow = advancedFlows[flowId];

```auto
const flowJson = JSON.stringify(flow).toLowerCase();

if (flowJson.includes(searchText)) {
    result.flows.push({
        type: "advancedflow",
        name: flow.name,
        id: flow.id
    });
}

```

}

result.matches = result.flows.length;

return JSON.stringify(result);

---

<div class="post-metadata">

**Author:** ![Drako74](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/drako74/32/150506_2.png) [@Drako74](https://community.homey.app/u/Drako74)\
**Post date:** [December 4, 2026, 12:49pm UTC](https://community.homey.app/t/finding-a-specific-flow-that-causes-a-ghost-trigger/163071/2 "2026-12-04T12:49:17Z")

</div>

Hi @Theuns_vanNiekerk

There’s already an app that does that, the most excellent Device Capabilities app

> **[Device Capabilities | Homey](https://homey.app/en-gb/app/nl.qluster-it.DeviceCapabilities/)**
>
> Enhance the capabilities of devices

For example:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/d/9d5d222ff57650f9106ed1ae6dd259919f9472da.png)

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

---

<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:** [December 4, 2026, 7:27pm UTC](https://community.homey.app/t/finding-a-specific-flow-that-causes-a-ghost-trigger/163071/3 "2026-12-04T19:27:28Z")

</div>

Please format the code as code. I think you agree with me it makes no sense the way it is posted, plus it is impossible to copy/paste, when I only look to the fancy (double) quotes you posted. Only straight (double) quotes are valid.

> [@\[Tip\] Please use Preformatted Text for Logs and Code Blocks for cleaner posts](https://community.homey.app/t/tip-please-use-preformatted-text-for-logs-and-code-blocks-for-cleaner-posts/149488):
>
> To ensure our community can provide the best help, please use Preformatted Text for all technical content. Why Use Preformatted Text? When you paste logs, configuration files, or code snippets as plain text, Discourse often alters the formatting. This makes it difficult to read and can strip away crucial characters needed to diagnose your issue. If you didn’t create it yourself, like logs or JSONs (interviews) paste it as Preformatted Text! For smaller Code, Logs etc. in context of a topic, b…

.

About the peculiar variable as in-between: You can enter the JSON right into the argument field, just make sure it is on one line:

 ![Screenshot_20261204_202235_Ecosia](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/a/8a3ed1c6e4dfa7aab5764095c5dca9609b17ec7c.jpeg)

Imho the caseSensitive and maxResults options can be hard-coded in the script, which makes entering the search phrase less complicated.
