Homey Community Forum

Found multiple Flow card triggers with the id "xxxxxx"

I defined some actions and triggers in the .homeycompose/drivers/flow/ directory, and then used these flow cards through ‘$extend’ in /drivers/<driver_id>/driver.flow.compose.json, but after compiling all the drivers’s flow cards will prompt a warning: found multiple Flow card triggers/actions with the id “xxxx”, all Flow cards should have a unique id.
It was normal in the previous version. This happened after upgrading to v3. How should I use the flow cards in compose?

Hello,
I got the same problem while updating an existing app after Athom changed the validation.

My problem:
I have two devices with a set of identical measures and identical flow trigger (measure_xxx_changed).
So some capabilities and flow elements have the same ID. The validation throws the error:
Found multiple Flow card triggers with the id “measure_last_waterusage_changed”, all Flow cards should have a unique id.

What is the best aproach to correct the flow IDs without breaking existing flows?
I would believe renaming of flow IDs will break all flows where this trigger is used. How can I adapt the app for validation without annoy users to rebuild their flows?

Many thanks for a hint :slight_smile:

Just want to add some details and questions.

The only information about the new validation I got via Athom Developer Mail:
In addition to the changes above, all Homey Apps with duplicate Flow Card IDs will throw an error instead of showing a warning message.

The SDK description says, that the driver.flow.compose.json defines the flows for only this driver.
In the past, each driver had the same flows with same ID and it was working fine. So it seems, technical the flow must be unique for a driver, but not for the whole app (excluding app flows).
What ist the advantage of the new validation?

Is there a developer who adapted the flow ids?
How did you manage it? Did it break the user flows (I would assume that).
The default flows for capabilities are generated. It’s only needed to define the flow id with the capability name (capabilityname_changed).
Will it work after renaming the flow id (e.g. capabilityname_changed_driverid)?

Many questions… It would be nice if someone could write some experiences around these flow id renaming :slight_smile:

Hello Tom,

I got a solution in the Slack channel:

Great! it works, thank you, RonnyW.
But when I call registerRunListener in different drivers to register the same action, it still get a warning. If you have encountered the same problem?
image

Hehe, we had the same idea about device depending conditions/actions :slight_smile:
But this is not handled by the device class.

You have to define the handler in the app and call the function of your device.

Condition definition (.homeycompose) with device argument:
grafik

Handler in app.js (onInit()):
grafik

It’s reading the device capability with calling the device function (args.device.)

So you have one handler for all devices and propagate the call to the current device.

well,before the version update, I have been registerRunListener in the driver, which works very well. This problem occurred after the update :sweat_smile:

haha. as you said, registering it in app.js did solve this problem, thank you very much!! :blush:

The warning occoured after a npm update of Homey. Or you have added a second device with the same listener.
The Athom documentation only uses app conditions as example. I found the example for device conditions in another app.