Generated capability flow triggers

Hello,

I still need some help for getting the generated capability flow triggers to work.
The changed app validation is causing problems for me when using the same capability in two drivers.
I hope someone can provide some hints or examples (existing gitbub projects).

That’s the current situation:

  • all capabilities are defined in ./homeycompose/capabilities (let’s name them a, b, c)
  • 2 drivers are defined in /drivers/driver1 and /drivers/driver2
  • The drivers get their capabilities assigned in driver.compose.json (driver1: capability a+b, driver 2: capabilities a+b+c)
  • the flows (capability changed) are defined for each driver in driver.flow.compose.json:
    driver1: a_changed + b_changed
    driver 2: a_changed + b_changed + c_changed
  • => this was working good until the new validation was provided by Athom. Now the error message about duplicated flow ids appears (for a_changed and b_changed).

I tried to define the flow triggers in /.homeycompose/flows/triggers.
But this way I only get flow triggers for the app, not for aech device (and their capabilities).

I don’t want to rename the flow id because this would break all existing flows for users.

My questions:

  • Is there a way to define the flow triggers (/.homeycompose/flows/triggers) and assign them to a driver (like it’s done for capabilities)? I didn’t found an example in developer help.
  • Or am I missing something defining the triggers in driver.flow.compose.json? Is it really needed to have unique trigger IDs even if the trigger is defined only for this device? Then the ID should be unique for the device?
  • The capability-changed-triggers must be defined for each device to appear in the flows.
    But: The new capability-gets-greater triggers are generated without defining something in compose-jsons. Is it possible to get capability-changed triggers generated without define them for each device?

I got a solution in the Athom Slack channel…

If you have 2 devices with the same capabilities and your are defining the flow trigger for each device in device.flow.compose.json, the definition ist copied into the app.json and the flow IDs are duplicated.

Solution:
Define the flow trigger one in .homeycompose/flow/triggers as single file for each flow.
Add the device argument and assign teh driver IDs where the flow should appear.

grafik


{
    "id": "measure_last_reg_percent_changed",
    "title": {
        "en": "Last regeneration percent has changed",
        "de": "Letzte Regeneration (Prozent) hat sich geändert"
    },
    "hint": {
        "en": "The percentage of a full regeration if not the whole capacity was used.",
        "de": "Der Prozentsatz einer vollen Regeneration, wenn nicht die gesamte Kapazität aufgebraucht wurde."
    },
    "args": [
        {
            "name": "device",
            "type": "device",
            "filter": "driver_id=softliq-sc|softliq-sd"
        }
      ]
}
1 Like