Homey Apps SDK
📖 Apps SDK Reference🌍 Web API🛠 Developer Tools
  • Welcome to the Apps SDK documentation 👋
  • The Basics
    • Getting Started
      • Homey CLI
    • App
      • Manifest
      • Internationalization
      • Permissions
      • Persistent Storage
    • Drivers & Devices
      • Pairing
        • System Views
          • Devices List
          • Add Devices
          • OAuth2 Login
          • Credentials Login
          • Pincode
          • Loading
          • Done
        • Custom Views
      • Capabilities
      • Energy
      • Settings
      • Best practices
        • Lights
        • Window coverings
        • Battery status
    • Flow
      • Arguments
      • Tokens
    • Widgets
      • Settings
      • Styling
      • Debugging
  • Wireless
    • Wi-Fi
      • Discovery
    • Bluetooth LE
    • Z-Wave
    • Zigbee
    • 433 MHz
    • Infrared
    • Matter
  • Cloud
    • OAuth2
    • Webhooks
  • App Store
    • Publishing
    • Guidelines
    • Verified Developer
    • Updating
  • Advanced
    • Custom Views
      • App Settings
      • Custom Pairing Views
      • HTML & CSS Styling
    • Web API
    • Images
    • LED Ring
    • Homey Compose
  • Guides
    • Homey Cloud
    • Breaking Changes
    • Tools
      • Bluetooth LE
      • Zigbee
      • TypeScript
    • Using ESM in Homey Apps
  • Upgrade Guides
    • Homey v6.0.0
    • Upgrading to SDK v3
      • Zigbee Apps
    • Device Capabilities
Powered by GitBook
On this page
  • Keeping your custom capability
  • Device Flow Cards
  • Registering Run Listeners
  • Duration
  • Capabilities

Was this helpful?

  1. Upgrade Guides

Device Capabilities

PreviousZigbee Apps

Last updated 8 months ago

Was this helpful?

Starting from version 12.2.0, Homey Pro (Early) 2023 will shift its approach to favour custom capabilities over system capabilities, aligning with the behaviour already seen in Homey Pro 2016-2019.

Currently, when a custom capability on Homey Pro (Early) 2023 shares an ID with a system capability, system Flow cards are generated for that device. However, with the upcoming change, these Flow cards will no longer be available.

To ensure that existing Flows continue to work seamlessly, apps that use system IDs for custom capabilities will need to update their drivers. There are two ways to make sure nothing in your app breaks. The easiest way is to remove your custom capability from your .homeycompose. This will instead make Homey use the system capability and generate the system Flow cards.

Keeping your custom capability

You can also choose to keep your custom capability. This can be useful if it differs from the system capability. To avoid breaking Flow cards, make sure to add a flow.compose.json to the effected Drivers containing the Flow cards with the same Flow IDs.

The capability IDs listed below are currently used in various apps as custom capabilities. Each file contains the Flow card ID's for that capability. By copying these Flow card ID's and adding them to your drivers flow.compose.json all Flows should keep running.

Device Flow Cards

When your app has multiple drivers that require the same device Flow card, you can put the Flow card definition in your .homeycompose. You can then add a device argument and a filter to make the Flow card appear for the right drivers. See for more information.

/.homeycompose/flow/actions/disco_mode.json
{
  "title": { "en": "Disco mode" },
  "args": [
    {
      "type": "device",
      "name": "device",
      "filter": "driver_id=my_driver"
    }
  ]
}

Registering Run Listeners

For some Flow cards you will also need to register the correct listeners. The listeners for each capability can be found below the corresponding files. These listeners can be added to your app in the app.js onInit() function.

Duration

If you have enabled duration for any capabilities through the capability options, you will also have to add duration: true to each action Flow card that should support it in your driver.flow.compose.json.

/drivers/<driver_id>/driver.flow.compose.json
{
  "actions": [
    {
      "id": "on",
      "highlight": true,
      "duration": true,
      "title": { "en": "Turn on" }
    }
  ]
}

Capabilities

/app.js
this.homey.flow.getConditionCard('alarm_contact').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('alarm_contact');
});
/app.js
this.homey.flow.getConditionCard('alarm_generic').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('alarm_generic');
});
/app.js
this.homey.flow.getConditionCard('alarm_motion').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('alarm_motion');
});
/app.js
this.homey.flow.getConditionCard('alarm_smoke').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('alarm_smoke');
});
/app.js
this.homey.flow.getConditionCard('alarm_tamper').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('alarm_tamper');
});
/app.js
this.homey.flow.getDeviceTriggerCard('homealarm_state_changed').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('homealarm_state') === args.state;
});
this.homey.flow.getConditionCard('homealarm_state_is').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('homealarm_state') === args.state;
});
this.homey.flow.getActionCard('set_homealarm_state').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('homealarm_state', args.state);
});
/app.js
this.homey.flow.getConditionCard('on').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('onoff');
});
this.homey.flow.getConditionCard('open').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('onoff');
});
this.homey.flow.getActionCard('on').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('onoff', true);
});
this.homey.flow.getActionCard('off').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('onoff', false);
});
this.homey.flow.getActionCard('toggle').registerRunListener((args, state) => {
  const value = args.device.getCapabilityValue('onoff');
  return args.device.setCapabilityValue('onoff', !value);
});
this.homey.flow.getActionCard('open').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('onoff', true);
});
this.homey.flow.getActionCard('close').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('onoff', false);
});
/app.js
this.homey.flow.getActionCard('target_temperature_set').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('target_temperature', args.target_temperature);
});
/app.js
this.homey.flow.getDeviceTriggerCard('thermostat_mode_changed').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('thermostat_mode') === args.thermostat_mode;
});
this.homey.flow.getConditionCard('thermostat_mode_is').registerRunListener((args, state) => {
  return args.device.getCapabilityValue('thermostat_mode') === args.thermostat_mode;
});
this.homey.flow.getActionCard('thermostat_mode_set').registerRunListener((args, state) => {
  return args.device.setCapabilityValue('thermostat_mode', args.thermostat_mode);
});
device Flow arguments
2KB
alarm_contact.json
2KB
alarm_generic.json
2KB
alarm_motion.json
2KB
alarm_smoke.json
2KB
alarm_tamper.json
7KB
homealarm_state.json
1KB
measure_battery.json
1KB
measure_co.json
1KB
measure_co2.json
1KB
measure_current.json
1KB
measure_humidity.json
1KB
measure_luminance.json
1KB
measure_pm25.json
1KB
measure_power.json
1KB
measure_pressure.json
1KB
measure_rain.json
1KB
measure_temperature.json
1KB
measure_ultraviolet.json
1KB
measure_voltage.json
1KB
measure_wind_angle.json
1KB
measure_wind_strength.json
1KB
meter_power.json
1KB
meter_water.json
5KB
onoff.json
2KB
target_temperature.json
8KB
thermostat_mode.json