Homey Compose

Homey Compose makes developing Homey Apps easier by splitting up the App Manifest into multiple smaller manifests.

File structure

The file structure when using compose looks as follows. This is an overview of all files that can be used with Homey Compose.

com.athom.example/
├─ .homeycompose/
│  ├─ app.json
│  ├─ capabilities/
│  │  └─ <id>.json
│  ├─ screensavers/
│  │  └─ <id>.json
│  ├─ signals/
│  │  ├─ 433/
│  │  │  └─ <id>.json
│  │  ├─ 868/
│  │  │  └─ <id>.json
│  │  └─ ir/
│  │     └─ <id>.json
│  ├─ flow/
│  │  ├─ triggers/
│  │  │  └─ <id>.json
│  │  ├─ conditions/
│  │  │  └─ <id>.json
│  │  └─ actions/
│  │     └─ <id>.json
│  ├─ discovery/
│  │  └─ <id>.json
│  ├─ drivers/
│  │  ├─ templates/
│  │  │  └─ <template_id>.json
│  │  ├─ settings/
│  │  │  └─ <setting_id>.json
│  │  └─ flow/
│  │     ├─ triggers/
│  │     │  └─ <id>.json
│  │     ├─ conditions/
│  │     │  └─ <id>.json
│  │     └─ actions/
│  │        └─ <id>.json
│  └─ locales/
│     ├─ <locale>.json
│     └─ <locale.foo>.json
└─ drivers/
   └─ <driver_id>/
      ├─ driver.compose.json
      ├─ driver.flow.compose.json
      └─ driver.settings.compose.json

Templating

Compose also allows for creating driver and setting templates to share common properties, for example RF signals, assets, etc. You can create a driver template by placing the shared properties in .homeycompose/drivers/templates/<template_id>.json. Then extend from the template in your driver compose file by placing the template id the $extends property in driver.compose.json. Compose will copy all properties from the template to the final file. Should you want to overwrite a property, you can do so by placing it in your driver.compose.json.

/.homeycompose/drivers/templates/defaults.json
{
  "images": {
    "large": "{{driverAssetsPath}}/images/large.png",
    "small": "{{driverAssetsPath}}/images/small.png"
  },
  "icon": "{{driverAssetsPath}}/icon.svg",
  "capabilities": [],
  "class": "other"
}
/drivers/my_driver/driver.compose.json
{
  "name": {
    "en": "My Driver",
    "nl": "Mijn Driver"
  },
  "$extends": ["defaults"]
}

By using this template, you only have to place the values that are uniqiue to a driver in the driver.compose.json file. All other required properties are copied over from the template.

Last updated